Changeset 2428 for code/branches/objecthierarchy2/src/orxonox/objects/worldentities/ControllableEntity.cc
- Timestamp:
- Dec 13, 2008, 10:54:26 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy2/src/orxonox/objects/worldentities/ControllableEntity.cc
r2361 r2428 38 38 #include "objects/worldentities/Camera.h" 39 39 #include "objects/worldentities/CameraPosition.h" 40 #include "objects/gametypes/Gametype.h" 40 41 #include "overlays/OverlayGroup.h" 41 42 … … 59 60 this->bDestroyWhenPlayerLeft_ = false; 60 61 62 this->gtinfo_ = 0; 63 this->gtinfoID_ = OBJECTID_UNKNOWN; 64 this->changedGametype(); 65 61 66 this->velocity_ = Vector3::ZERO; 62 67 this->acceleration_ = Vector3::ZERO; … … 98 103 99 104 XMLPortObject(ControllableEntity, CameraPosition, "camerapositions", addCameraPosition, getCameraPosition, xmlelement, mode); 105 } 106 107 void ControllableEntity::changedGametype() 108 { 109 SUPER(ControllableEntity, changedGametype); 110 111 this->gtinfo_ = 0; 112 this->gtinfoID_ = OBJECTID_UNKNOWN; 113 114 if (this->getGametype() && this->getGametype()->getGametypeInfo()) 115 { 116 this->gtinfo_ = this->getGametype()->getGametypeInfo(); 117 this->gtinfoID_ = this->gtinfo_->getObjectID(); 118 } 100 119 } 101 120 … … 199 218 } 200 219 220 void ControllableEntity::networkcallback_changedgtinfoID() 221 { 222 if (this->gtinfoID_ != OBJECTID_UNKNOWN) 223 { 224 this->gtinfo_ = dynamic_cast<GametypeInfo*>(Synchronisable::getSynchronisable(this->gtinfoID_)); 225 226 if (!this->gtinfo_) 227 this->gtinfoID_ = OBJECTID_UNKNOWN; 228 } 229 } 230 201 231 void ControllableEntity::startLocalHumanControl() 202 232 { … … 268 298 269 299 REGISTERDATA(this->playerID_, direction::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::networkcallback_changedplayerID)); 300 REGISTERDATA(this->gtinfoID_, direction::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::networkcallback_changedgtinfoID)); 270 301 } 271 302
Note: See TracChangeset
for help on using the changeset viewer.