Changeset 2973 for code/trunk/src/orxonox/objects/infos/PlayerInfo.cc
- Timestamp:
- May 12, 2009, 9:24:58 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/objects/infos/PlayerInfo.cc
r2839 r2973 51 51 this->controllableEntityID_ = CLIENTID_UNKNOWN; 52 52 53 this->gtinfo_ = 0; 54 this->gtinfoID_ = OBJECTID_UNKNOWN; 55 this->updateGametypeInfo(); 56 53 57 this->registerVariables(); 54 58 } … … 76 80 registerVariable(this->controllableEntityID_, variableDirection::toclient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedcontrollableentityID)); 77 81 registerVariable(this->bReadyToSpawn_, variableDirection::toserver); 82 registerVariable(this->gtinfoID_, variableDirection::toclient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedgtinfoID)); 78 83 } 79 84 … … 88 93 void PlayerInfo::changedGametype() 89 94 { 95 this->updateGametypeInfo(); 96 90 97 if (this->isInitialized()) 91 98 { … … 108 115 } 109 116 117 void PlayerInfo::updateGametypeInfo() 118 { 119 this->gtinfo_ = 0; 120 this->gtinfoID_ = OBJECTID_UNKNOWN; 121 122 if (this->getGametype() && this->getGametype()->getGametypeInfo()) 123 { 124 this->gtinfo_ = this->getGametype()->getGametypeInfo(); 125 this->gtinfoID_ = this->gtinfo_->getObjectID(); 126 } 127 } 128 110 129 void PlayerInfo::createController() 111 130 { … … 181 200 } 182 201 } 202 203 void PlayerInfo::networkcallback_changedgtinfoID() 204 { 205 if (this->gtinfoID_ != OBJECTID_UNKNOWN) 206 { 207 this->gtinfo_ = dynamic_cast<GametypeInfo*>(Synchronisable::getSynchronisable(this->gtinfoID_)); 208 209 if (!this->gtinfo_) 210 this->gtinfoID_ = OBJECTID_UNKNOWN; 211 } 212 } 183 213 }
Note: See TracChangeset
for help on using the changeset viewer.