Changeset 2826 for code/trunk/src/orxonox/objects/infos
- Timestamp:
- Mar 23, 2009, 12:02:49 PM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/miniprojects (added) merged: 2755,2768,2789,2806,2818-2821,2824
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/infos/GametypeInfo.cc
r2662 r2826 58 58 registerVariable(this->startCountdown_, variableDirection::toclient); 59 59 registerVariable(this->bStartCountdownRunning_, variableDirection::toclient); 60 registerVariable(this->hudtemplate_, variableDirection::toclient); 60 61 } 61 62 } -
code/trunk/src/orxonox/objects/infos/GametypeInfo.h
r2662 r2826 56 56 { return this->startCountdown_; } 57 57 58 inline const std::string& getHUDTemplate() const 59 { return this->hudtemplate_; } 60 58 61 private: 59 62 bool bStarted_; … … 61 64 bool bStartCountdownRunning_; 62 65 float startCountdown_; 66 std::string hudtemplate_; 63 67 }; 64 68 } -
code/trunk/src/orxonox/objects/infos/HumanPlayer.cc
r2662 r2826 53 53 this->defaultController_ = Class(HumanController); 54 54 55 this->humanHud_ = 0; 56 this->gametypeHud_ = 0; 57 55 58 this->setConfigValues(); 56 59 this->registerVariables(); … … 59 62 HumanPlayer::~HumanPlayer() 60 63 { 64 if (this->BaseObject::isInitialized()) 65 { 66 if (this->humanHud_) 67 delete this->humanHud_; 68 69 if (this->gametypeHud_) 70 delete this->gametypeHud_; 71 } 61 72 } 62 73 … … 89 100 void HumanPlayer::configvaluecallback_changedHUDTemplate() 90 101 { 91 this-> changedController();102 this->setHumanHUDTemplate(this->hudtemplate_); 92 103 } 93 104 … … 111 122 112 123 this->createController(); 124 this->updateHumanHUD(); 113 125 } 114 126 } … … 146 158 } 147 159 148 void HumanPlayer::changedController() 149 { 150 if (this->getController()) 151 { 152 this->getController()->setHUDTemplate(this->hudtemplate_); 153 154 if (this->getController() && this->getController()->getHUD()) 155 this->getController()->getHUD()->setOwner(this->getControllableEntity()); 160 void HumanPlayer::changedGametype() 161 { 162 PlayerInfo::changedGametype(); 163 164 if (this->isInitialized() && this->isLocalPlayer()) 165 if (this->getGametype()->getHUDTemplate() != "") 166 this->setGametypeHUDTemplate(this->getGametype()->getHUDTemplate()); 167 } 168 169 void HumanPlayer::changedControllableEntity() 170 { 171 PlayerInfo::changedControllableEntity(); 172 173 if (this->humanHud_) 174 this->humanHud_->setOwner(this->getControllableEntity()); 175 176 if (this->gametypeHud_) 177 this->gametypeHud_->setOwner(this->getControllableEntity()); 178 } 179 180 void HumanPlayer::updateHumanHUD() 181 { 182 if (this->humanHud_) 183 { 184 delete this->humanHud_; 185 this->humanHud_ = 0; 186 } 187 188 if (this->isLocalPlayer() && this->humanHudTemplate_ != "") 189 { 190 this->humanHud_ = new OverlayGroup(this); 191 this->humanHud_->addTemplate(this->humanHudTemplate_); 192 this->humanHud_->setOwner(this->getControllableEntity()); 193 } 194 } 195 196 void HumanPlayer::updateGametypeHUD() 197 { 198 if (this->gametypeHud_) 199 { 200 delete this->gametypeHud_; 201 this->gametypeHud_ = 0; 202 } 203 204 if (this->isLocalPlayer() && this->gametypeHudTemplate_ != "") 205 { 206 this->gametypeHud_ = new OverlayGroup(this); 207 this->gametypeHud_->addTemplate(this->gametypeHudTemplate_); 208 this->gametypeHud_->setOwner(this->getControllableEntity()); 156 209 } 157 210 } -
code/trunk/src/orxonox/objects/infos/HumanPlayer.h
r2662 r2826 51 51 void setClientID(unsigned int clientID); 52 52 53 virtual void changedController(); 53 virtual void changedGametype(); 54 virtual void changedControllableEntity(); 55 56 inline void setHumanHUDTemplate(const std::string& name) 57 { 58 if (name != this->humanHudTemplate_) 59 { 60 this->humanHudTemplate_ = name; 61 this->updateHumanHUD(); 62 } 63 } 64 inline const std::string& getHumanHUDTemplate() const 65 { return this->humanHudTemplate_; } 66 inline OverlayGroup* getHumanHUD() const 67 { return this->humanHud_; } 68 69 inline void setGametypeHUDTemplate(const std::string& name) 70 { 71 if (name != this->gametypeHudTemplate_) 72 { 73 this->gametypeHudTemplate_ = name; 74 this->updateGametypeHUD(); 75 } 76 } 77 inline const std::string& getGametypeHUDTemplate() const 78 { return this->gametypeHudTemplate_; } 79 inline OverlayGroup* getGametypeHUD() const 80 { return this->gametypeHud_; } 54 81 55 82 protected: … … 61 88 void networkcallback_client_initialized(); 62 89 90 void updateHumanHUD(); 91 void updateGametypeHUD(); 92 63 93 std::string nick_; 64 94 std::string synchronize_nick_; … … 66 96 bool server_initialized_; 67 97 bool client_initialized_; 98 99 std::string humanHudTemplate_; 100 OverlayGroup* humanHud_; 101 std::string gametypeHudTemplate_; 102 OverlayGroup* gametypeHud_; 68 103 }; 69 104 } -
code/trunk/src/orxonox/objects/infos/PlayerInfo.cc
r2662 r2826 141 141 if (this->controller_) 142 142 this->controller_->setControllableEntity(entity); 143 144 this->changedControllableEntity(); 143 145 } 144 146 … … 155 157 if (callback) 156 158 entity->removePlayer(); 159 160 this->changedControllableEntity(); 157 161 } 158 162 } -
code/trunk/src/orxonox/objects/infos/PlayerInfo.h
r2662 r2826 49 49 virtual void changedGametype(); 50 50 51 virtual void changedController() {} 52 virtual void changedControllableEntity() {} 53 51 54 inline bool isHumanPlayer() const 52 55 { return this->bHumanPlayer_; } … … 73 76 inline Controller* getController() const 74 77 { return this->controller_; } 75 virtual void changedController() {}76 78 77 79 protected:
Note: See TracChangeset
for help on using the changeset viewer.