Changeset 590 for code/branches/FICN/src
- Timestamp:
- Dec 17, 2007, 8:23:26 PM (17 years ago)
- Location:
- code/branches/FICN/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FICN/src/network/GameStateManager.cc
r573 r590 82 82 //the size of the gamestate 83 83 int totalsize=0; 84 int memsize=1000; 84 85 //the size of one specific synchronisable 85 86 int tempsize=0; … … 93 94 // reserve a little memory and increase it later on 94 95 COUT(2) << "mallocing" << std::endl; 95 retval->data = (unsigned char*)malloc( 1);96 retval->data = (unsigned char*)malloc(memsize); 96 97 COUT(2) << "malloced" << std::endl; 97 98 … … 106 107 totalsize+=tempsize+3*sizeof(int); 107 108 // 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 } 109 113 110 114 // 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 30 30 name_ = xmlElem->Attribute("name"); 31 31 mesh_ = xmlElem->Attribute("src"); 32 std::string node= xmlElem->Attribute("node");32 node_ = xmlElem->Attribute("node"); 33 33 34 // get the node35 this->setNode(Orxonox::getSingleton()->getSceneManager()->getSceneNode(node));36 37 38 34 // register variables to be synchronised 39 35 registerAllVariables(); … … 41 37 create(); 42 38 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; 44 40 } 45 41 } … … 49 45 registerVar(&name_, name_.length()+1, network::STRING); 50 46 registerVar(&mesh_, mesh_.length()+1, network::STRING); 47 registerVar(&node_, node_.length()+1, network::STRING); 51 48 } 52 49 … … 54 51 if(!valid) 55 52 return false; 53 // get the node 54 this->setNode(Orxonox::getSingleton()->getSceneManager()->getSceneNode(node_)); 56 55 Ogre::SceneManager* mgr = orxonox::Orxonox::getSingleton()->getSceneManager(); 57 56 -
code/branches/FICN/src/orxonox/objects/BaseEntity.h
r568 r590 22 22 std::string name_; 23 23 std::string mesh_; 24 std::string node_; 24 25 // other membervariables 25 Ogre::SceneNode *sceneNode_;26 //Ogre::SceneNode *sceneNode_; 26 27 bool valid; 27 28 }; -
code/branches/FICN/src/orxonox/objects/SceneNode.cc
r580 r590 77 77 } 78 78 } 79 80 void SceneNode::registerAllVariables(){ 81 82 } 83 84 bool SceneNode::create(){ 85 return true; 86 } 87 79 88 } -
code/branches/FICN/src/orxonox/objects/SceneNode.h
r515 r590 4 4 #include "BaseObject.h" 5 5 #include "../../tinyxml/tinyxml.h" 6 #include "network/Synchronisable.h" 6 7 7 8 namespace orxonox 8 9 { 9 class SceneNode : public BaseObject 10 class SceneNode : public BaseObject, public network::Synchronisable 10 11 { 11 12 public: 12 13 13 SceneNode(); 14 virtual ~SceneNode(); 14 15 15 16 16 void loadParams(TiXmlElement* xmlElem); 17 17 void loadParams(TiXmlElement* xmlElem); 18 bool create(); 19 protected: 20 void registerAllVariables(); 18 21 private: 19 22 float x_, y_, z_; 23 float sx_, sy_, sz_; 24 float yaw_, pitch_, roll_; 25 std::string node_; 20 26 21 27 };
Note: See TracChangeset
for help on using the changeset viewer.