Changeset 2973 for code/trunk/src/orxonox/objects/infos
- Timestamp:
- May 12, 2009, 9:24:58 PM (16 years ago)
- Location:
- code/trunk/src/orxonox/objects/infos
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/objects/infos/HumanPlayer.cc
r2896 r2973 167 167 } 168 168 169 void HumanPlayer::changedControllableEntity()170 {171 PlayerInfo::changedControllableEntity();172 173 if (this->humanHud_)174 this->humanHud_->setOwner(this->getControllableEntity());175 }176 177 169 void HumanPlayer::updateHumanHUD() 178 170 { … … 187 179 this->humanHud_ = new OverlayGroup(this); 188 180 this->humanHud_->addTemplate(this->humanHudTemplate_); 189 this->humanHud_->setOwner(this ->getControllableEntity());181 this->humanHud_->setOwner(this); 190 182 } 191 183 } … … 203 195 this->gametypeHud_ = new OverlayGroup(this); 204 196 this->gametypeHud_->addTemplate(this->gametypeHudTemplate_); 205 this->gametypeHud_->setOwner(this ->getGametype());197 this->gametypeHud_->setOwner(this); 206 198 } 207 199 } -
code/trunk/src/orxonox/objects/infos/HumanPlayer.h
r2826 r2973 52 52 53 53 virtual void changedGametype(); 54 virtual void changedControllableEntity();55 54 56 55 inline void setHumanHUDTemplate(const std::string& name) -
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 } -
code/trunk/src/orxonox/objects/infos/PlayerInfo.h
r2826 r2973 77 77 { return this->controller_; } 78 78 79 inline const GametypeInfo* getGametypeInfo() const 80 { return this->gtinfo_; } 81 79 82 protected: 80 83 void createController(); … … 88 91 private: 89 92 void networkcallback_changedcontrollableentityID(); 93 void networkcallback_changedgtinfoID(); 94 void updateGametypeInfo(); 90 95 91 96 bool bReadyToSpawn_; … … 93 98 ControllableEntity* controllableEntity_; 94 99 unsigned int controllableEntityID_; 100 101 const GametypeInfo* gtinfo_; 102 unsigned int gtinfoID_; 95 103 }; 96 104 }
Note: See TracChangeset
for help on using the changeset viewer.