Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 590


Ignore:
Timestamp:
Dec 17, 2007, 8:23:26 PM (17 years ago)
Author:
scheusso
Message:

enhanced memory handling

Location:
code/branches/FICN
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/bin/levels/sample.oxw

    r588 r590  
    99    <bar top="200" left="50" width="300" height="20" image="textures/load_screens/ambush-loadbar.png" />
    1010  </loading>
     11
    1112
    1213  <!-- <audio>
     
    3940
    4041    <SceneNode name="node1" pos="0,2000,0"  scale="40,40,40" />
    41     <Entity name="asteroid1" src="ast1.mesh" node="node1" />
     42    <BaseEntity name="asteroid1" src="ast1.mesh" node="node1" />
    4243
    4344    <SceneNode name="node2" pos="2000,0,0" scale="20,20,20"/>
    44     <Entity name="asteroid2" src="ast2.mesh" node="node2" />
     45    <BaseEntity name="asteroid2" src="ast2.mesh" node="node2" />
     46
    4547
    4648    <SceneNode name="node3" pos="0,0,2000" scale="20,20,20"/>
    47     <Entity name="aststeroid3" src="ast3.mesh" node="node3"/>
     49    <BaseEntity name="aststeroid3" src="ast3.mesh" node="node3"/>
    4850
    4951    <SceneNode name="node4" pos="0,-2000,0" scale="20,20,20"/>
    50     <Entity name="asteroid4" src="ast4.mesh" node="node4" />
     52    <BaseEntity name="asteroid4" src="ast4.mesh" node="node4" />
    5153
    5254    <SceneNode name="node5" pos="-2000,0,0" scale="20,20,20"/>
    53     <Entity name="asteroid5" src="ast5.mesh" node="node5" />
     55    <BaseEntity name="asteroid5" src="ast5.mesh" node="node5" />
    5456
    5557    <SceneNode name="node6" pos="0,0,-2000" scale="20,20,20"/>
    56     <Entity name="asteroid6" src="ast6.mesh" node="node6" />
     58    <BaseEntity name="asteroid6" src="ast6.mesh" node="node6" />
    5759
    5860    <SceneNode name="node7" pos="1000,1500,0"  scale="50,50,50" />
    5961    <Entity name="asteroid7" src="ast1.mesh" node="node7" />
     62
    6063
    6164
  • code/branches/FICN/src/network/GameStateManager.cc

    r573 r590  
    8282  //the size of the gamestate
    8383  int totalsize=0;
     84  int memsize=1000;
    8485  //the size of one specific synchronisable
    8586  int tempsize=0;
     
    9394  // reserve a little memory and increase it later on
    9495  COUT(2) << "mallocing" << std::endl;
    95   retval->data = (unsigned char*)malloc(1);
     96  retval->data = (unsigned char*)malloc(memsize);
    9697  COUT(2) << "malloced" << std::endl;
    9798
     
    106107    totalsize+=tempsize+3*sizeof(int);
    107108    // allocate additional space
    108     retval->data = (unsigned char *)realloc((void *)retval->data, totalsize);
     109    if(totalsize+tempsize>memsize){
     110      retval->data = (unsigned char *)realloc((void *)retval->data, totalsize+1000);
     111      memsize+=1000;
     112    }
    109113
    110114    // run Synchronisable::getData with offset and additional place for 3 ints in between (for ids and length)
  • code/branches/FICN/src/orxonox/objects/BaseEntity.cc

    r580 r590  
    3030        name_ = xmlElem->Attribute("name");
    3131        mesh_ = xmlElem->Attribute("src");
    32         std::string node = xmlElem->Attribute("node");
     32        node_ = xmlElem->Attribute("node");
    3333
    34         // get the node
    35         this->setNode(Orxonox::getSingleton()->getSceneManager()->getSceneNode(node));
    36 
    37        
    3834        // register variables to be synchronised
    3935        registerAllVariables();
     
    4137        create();
    4238
    43                 std::cout << "Loader: Created entity "<< name_ <<" with source " << mesh_  << " at node " << node  << std::endl << std::endl;
     39                std::cout << "Loader: Created entity "<< name_ <<" with source " << mesh_  << " at node " << node_  << std::endl << std::endl;
    4440        }
    4541   }
     
    4945     registerVar(&name_, name_.length()+1, network::STRING);
    5046     registerVar(&mesh_, mesh_.length()+1, network::STRING);
     47     registerVar(&node_, node_.length()+1, network::STRING);
    5148   }
    5249   
     
    5451     if(!valid)
    5552       return false;
     53     // get the node
     54     this->setNode(Orxonox::getSingleton()->getSceneManager()->getSceneNode(node_));
    5655     Ogre::SceneManager* mgr = orxonox::Orxonox::getSingleton()->getSceneManager();
    5756     
  • code/branches/FICN/src/orxonox/objects/BaseEntity.h

    r568 r590  
    2222      std::string name_;
    2323      std::string mesh_;
     24      std::string node_;
    2425    // other membervariables
    25       Ogre::SceneNode *sceneNode_;
     26      //Ogre::SceneNode *sceneNode_;
    2627      bool valid;
    2728  };
  • code/branches/FICN/src/orxonox/objects/SceneNode.cc

    r580 r590  
    7777        }
    7878   }
     79   
     80   void SceneNode::registerAllVariables(){
     81     
     82   }
     83   
     84   bool SceneNode::create(){
     85     return true;
     86   }
     87   
    7988}
  • code/branches/FICN/src/orxonox/objects/SceneNode.h

    r515 r590  
    44#include "BaseObject.h"
    55#include "../../tinyxml/tinyxml.h"
     6#include "network/Synchronisable.h"
    67
    78namespace orxonox
    89{
    9     class SceneNode : public BaseObject
     10    class SceneNode : public BaseObject, public network::Synchronisable
    1011    {
    1112        public:
    12             SceneNode();
    13             virtual ~SceneNode();
     13          SceneNode();
     14          virtual ~SceneNode();
    1415
    1516           
    16             void loadParams(TiXmlElement* xmlElem);
    17 
     17          void loadParams(TiXmlElement* xmlElem);
     18          bool create();
     19        protected:
     20          void registerAllVariables();
    1821        private:
    19            
     22          float x_, y_, z_;
     23          float sx_, sy_, sz_;
     24          float yaw_, pitch_, roll_;
     25          std::string node_;
    2026
    2127    };
Note: See TracChangeset for help on using the changeset viewer.