Changeset 927 for code/branches/network/src/orxonox
- Timestamp:
- Mar 26, 2008, 5:02:14 PM (17 years ago)
- Location:
- code/branches/network/src/orxonox/objects
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network/src/orxonox/objects/Model.cc
r871 r927 44 44 { 45 45 RegisterObject(Model); 46 registerAllVariables(); 46 47 } 47 48 … … 63 64 /** 64 65 @brief XML loading and saving. 65 @param xmlelement The XML-element 66 @p 67 aram xmlelement The XML-element 66 68 @param loading Loading (true) or saving (false) 67 69 @return The XML-element … … 82 84 83 85 bool Model::create(){ 86 WorldEntity::create(); 84 87 if(meshSrc_.compare("")!=0){ 85 88 this->mesh_.setMesh(meshSrc_); … … 87 90 COUT(4) << "Loader: Created model" << std::endl; 88 91 } 89 registerAllVariables();90 92 return true; 91 93 } 92 94 93 95 void Model::registerAllVariables(){ 94 // registerVar(&meshSrc_, meshSrc_.length() + 1, network::STRING); 96 WorldEntity::registerAllVariables(); 97 registerVar(&meshSrc_, meshSrc_.length() + 1, network::STRING); 95 98 } 96 99 } -
code/branches/network/src/orxonox/objects/Model.h
r871 r927 22 22 bool create(); 23 23 24 protected: 25 void registerAllVariables(); 26 24 27 private: 25 28 std::string meshSrc_; 26 29 Mesh mesh_; 27 void registerAllVariables();28 30 }; 29 31 } -
code/branches/network/src/orxonox/objects/SpaceShip.cc
r919 r927 56 56 { 57 57 RegisterObject(SpaceShip); 58 this->registerAllVariables(); 58 59 59 60 this->setConfigValues(); … … 125 126 this->brakeLoop(loop); 126 127 */ 127 this->init(); 128 128 // this->create(); 129 130 129 131 COUT(3) << "Info: SpaceShip was loaded" << std::endl; 130 132 } … … 136 138 } 137 139 140 bool SpaceShip::create(){ 141 if(Model::create()) 142 this->init(); 143 else 144 return false; 145 return true; 146 } 147 148 void SpaceShip::registerAllVariables(){ 149 Model::registerAllVariables(); 150 151 152 153 } 154 138 155 void SpaceShip::init() 139 156 { … … 203 220 { 204 221 Model::loadParams(xmlElem); 222 this->create(); 205 223 /* 206 224 if (xmlElem->Attribute("forward") && xmlElem->Attribute("rotateupdown") && xmlElem->Attribute("rotaterightleft") && xmlElem->Attribute("looprightleft")) -
code/branches/network/src/orxonox/objects/SpaceShip.h
r871 r927 21 21 SpaceShip(); 22 22 ~SpaceShip(); 23 bool create(); 24 void registerAllVariables(); 23 25 void init(); 24 26 void setConfigValues(); -
code/branches/network/src/orxonox/objects/WorldEntity.cc
r871 r927 49 49 RegisterObject(WorldEntity); 50 50 51 if (Orxonox::getSingleton()->getSceneManager()) 52 { 53 std::ostringstream name; 54 name << (WorldEntity::worldEntityCounter_s++); 55 this->setName("WorldEntity" + name.str()); 56 this->node_ = Orxonox::getSingleton()->getSceneManager()->getRootSceneNode()->createChildSceneNode(this->getName()); 57 } 58 else 59 { 60 this->node_ = 0; 61 } 51 //create(); 62 52 63 53 this->bStatic_ = true; … … 67 57 this->rotationRate_ = 0; 68 58 this->momentum_ = 0; 59 60 if (Orxonox::getSingleton()->getSceneManager()) 61 { 62 std::ostringstream name; 63 name << (WorldEntity::worldEntityCounter_s++); 64 this->setName("WorldEntity" + name.str()); 65 this->node_ = Orxonox::getSingleton()->getSceneManager()->getRootSceneNode()->createChildSceneNode(this->getName()); 66 67 registerAllVariables(); 68 } 69 else 70 { 71 this->node_ = 0; 72 } 69 73 } 70 74 … … 89 93 90 94 BaseObject::loadParams(xmlElem); 95 create(); 91 96 /* 92 97 if (xmlElem->Attribute("position")) … … 185 190 } 186 191 187 bool WorldEntity::create(){188 registerAllVariables();189 return true;190 }191 192 192 193 void WorldEntity::registerAllVariables() 193 194 { 194 /*// register coordinates195 // register coordinates 195 196 registerVar( (void*) &(this->getPosition().x), sizeof(this->getPosition().x), network::DATA); 196 197 registerVar( (void*) &(this->getPosition().y), sizeof(this->getPosition().y), network::DATA); … … 200 201 registerVar( (void*) &(this->getOrientation().x), sizeof(this->getOrientation().x), network::DATA); 201 202 registerVar( (void*) &(this->getOrientation().y), sizeof(this->getOrientation().y), network::DATA); 202 registerVar( (void*) &(this->getOrientation().z), sizeof(this->getOrientation().z), network::DATA); */203 registerVar( (void*) &(this->getOrientation().z), sizeof(this->getOrientation().z), network::DATA); 203 204 // not needed at the moment, because we don't have prediction yet 204 / *// register velocity_205 // register velocity_ 205 206 registerVar( (void*) &(this->getVelocity().x), sizeof(this->getVelocity().x), network::DATA); 206 207 registerVar( (void*) &(this->getVelocity().y), sizeof(this->getVelocity().y), network::DATA); … … 210 211 registerVar( (void*) &(this->getRotationAxis().x), sizeof(this->getRotationAxis().x), network::DATA); 211 212 registerVar( (void*) &(this->getRotationAxis().y), sizeof(this->getRotationAxis().y), network::DATA); 212 registerVar( (void*) &(this->getRotationAxis().z), sizeof(this->getRotationAxis().z), network::DATA); */213 registerVar( (void*) &(this->getRotationAxis().z), sizeof(this->getRotationAxis().z), network::DATA); 213 214 } 214 215 -
code/branches/network/src/orxonox/objects/WorldEntity.h
r917 r927 17 17 namespace orxonox 18 18 { 19 class _OrxonoxExport WorldEntity : public BaseObject, public Tickable //, public network::Synchronisable19 class _OrxonoxExport WorldEntity : public BaseObject, public Tickable, public network::Synchronisable 20 20 { 21 21 public: … … 26 26 virtual void loadParams(TiXmlElement* xmlElem); 27 27 virtual void XMLPort(Element& xmlelement, bool loading); 28 bool create();28 inline bool create(){ return true; } 29 29 30 30 void attachWorldEntity(WorldEntity* entity); -
code/branches/network/src/orxonox/objects/weapon/AmmunitionDump.cc
r871 r927 45 45 { 46 46 RegisterObject(AmmunitionDump); 47 registerAllVariables(); 47 48 48 49 for (int i = 0; i < numberOfAmmos_; i++) … … 114 115 return stock_[id]; 115 116 } 117 118 void AmmunitionDump::registerAllVariables(){ 119 registerVar( &numberOfAmmos_, sizeof(int), network::DATA); 120 121 for (int i = 0; i < numberOfAmmos_; i++) 122 { 123 registerVar(&stock_[i], sizeof(int), network::DATA); 124 registerVar(&capacity_[i], sizeof(int), network::DATA); 125 } 126 } 116 127 } -
code/branches/network/src/orxonox/objects/weapon/AmmunitionDump.h
r871 r927 60 60 protected: 61 61 inline bool create() { return true; } 62 void registerAllVariables(); 62 63 63 64 int numberOfAmmos_; -
code/branches/network/src/orxonox/objects/weapon/BulletManager.cc
r871 r927 39 39 { 40 40 RegisterObject(BulletManager); 41 registerAllVariables(); 41 42 bullets_ = new Bullet*[bulletsSize_]; 42 43 } … … 103 104 } 104 105 106 void BulletManager::registerAllVariables(){ 107 registerVar(&bulletsSize_, sizeof(int), network::DATA); 108 registerVar(&bulletsIndex_, sizeof(int), network::DATA); 109 // TODO we got a problem here: 110 // there is no possibility (so far) to synchronise pointers to objects 111 } 112 105 113 } -
code/branches/network/src/orxonox/objects/weapon/BulletManager.h
r917 r927 60 60 protected: 61 61 inline bool create() { return true; } 62 void registerAllVariables(); 62 63 63 64 // Bullet array
Note: See TracChangeset
for help on using the changeset viewer.