Changeset 2908 for code/branches/questsystem5/src/orxonox/objects/infos
- Timestamp:
- Apr 8, 2009, 12:58:47 AM (16 years ago)
- Location:
- code/branches/questsystem5
- Files:
-
- 2 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/questsystem5
- Property svn:mergeinfo changed
-
code/branches/questsystem5/src/orxonox/objects/infos/Bot.cc
r2907 r2908 30 30 #include "Bot.h" 31 31 32 #include "core/ GameMode.h"32 #include "core/Core.h" 33 33 #include "core/CoreIncludes.h" 34 34 #include "core/ConfigValueIncludes.h" … … 46 46 47 47 this->bHumanPlayer_ = false; 48 this->bLocalPlayer_ = GameMode::isMaster();48 this->bLocalPlayer_ = Core::isMaster(); 49 49 this->bSetUnreadyAfterSpawn_ = false; 50 50 this->setReadyToSpawn(true); -
code/branches/questsystem5/src/orxonox/objects/infos/CMakeLists.txt
r2907 r2908 1 1 ADD_SOURCE_FILES(ORXONOX_SRC_FILES 2 2 Bot.cc 3 PongBot.cc4 3 Info.cc 5 4 PlayerInfo.cc -
code/branches/questsystem5/src/orxonox/objects/infos/GametypeInfo.cc
r2907 r2908 58 58 registerVariable(this->startCountdown_, variableDirection::toclient); 59 59 registerVariable(this->bStartCountdownRunning_, variableDirection::toclient); 60 registerVariable(this->hudtemplate_, variableDirection::toclient);61 60 } 62 61 } -
code/branches/questsystem5/src/orxonox/objects/infos/GametypeInfo.h
r2907 r2908 56 56 { return this->startCountdown_; } 57 57 58 inline const std::string& getHUDTemplate() const59 { return this->hudtemplate_; }60 61 58 private: 62 59 bool bStarted_; … … 64 61 bool bStartCountdownRunning_; 65 62 float startCountdown_; 66 std::string hudtemplate_;67 63 }; 68 64 } -
code/branches/questsystem5/src/orxonox/objects/infos/HumanPlayer.cc
r2907 r2908 30 30 #include "HumanPlayer.h" 31 31 32 #include "core/ GameMode.h"32 #include "core/Core.h" 33 33 #include "core/CoreIncludes.h" 34 34 #include "core/ConfigValueIncludes.h" … … 47 47 RegisterObject(HumanPlayer); 48 48 49 this->server_initialized_ = GameMode::isMaster();49 this->server_initialized_ = Core::isMaster(); 50 50 this->client_initialized_ = false; 51 51 52 52 this->bHumanPlayer_ = true; 53 53 this->defaultController_ = Class(HumanController); 54 55 this->humanHud_ = 0;56 this->gametypeHud_ = 0;57 54 58 55 this->setConfigValues(); … … 62 59 HumanPlayer::~HumanPlayer() 63 60 { 64 if (this->BaseObject::isInitialized())65 {66 if (this->humanHud_)67 delete this->humanHud_;68 69 if (this->gametypeHud_)70 delete this->gametypeHud_;71 }72 61 } 73 62 … … 93 82 this->synchronize_nick_ = this->nick_; 94 83 95 if ( GameMode::isMaster())84 if (Core::isMaster()) 96 85 this->setName(this->nick_); 97 86 } … … 100 89 void HumanPlayer::configvaluecallback_changedHUDTemplate() 101 90 { 102 this-> setHumanHUDTemplate(this->hudtemplate_);91 this->changedController(); 103 92 } 104 93 … … 116 105 this->client_initialized_ = true; 117 106 118 if (! GameMode::isMaster())107 if (!Core::isMaster()) 119 108 this->setObjectMode(objectDirection::bidirectional); 120 109 else … … 122 111 123 112 this->createController(); 124 this->updateHumanHUD();125 113 } 126 114 } … … 158 146 } 159 147 160 void HumanPlayer::changed Gametype()148 void HumanPlayer::changedController() 161 149 { 162 PlayerInfo::changedGametype(); 150 if (this->getController()) 151 { 152 this->getController()->setHUDTemplate(this->hudtemplate_); 163 153 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 177 void HumanPlayer::updateHumanHUD() 178 { 179 if (this->humanHud_) 180 { 181 delete this->humanHud_; 182 this->humanHud_ = 0; 183 } 184 185 if (this->isLocalPlayer() && this->humanHudTemplate_ != "") 186 { 187 this->humanHud_ = new OverlayGroup(this); 188 this->humanHud_->addTemplate(this->humanHudTemplate_); 189 this->humanHud_->setOwner(this->getControllableEntity()); 190 } 191 } 192 193 void HumanPlayer::updateGametypeHUD() 194 { 195 if (this->gametypeHud_) 196 { 197 delete this->gametypeHud_; 198 this->gametypeHud_ = 0; 199 } 200 201 if (this->isLocalPlayer() && this->gametypeHudTemplate_ != "") 202 { 203 this->gametypeHud_ = new OverlayGroup(this); 204 this->gametypeHud_->addTemplate(this->gametypeHudTemplate_); 205 this->gametypeHud_->setOwner(this->getGametype()); 154 if (this->getController() && this->getController()->getHUD()) 155 this->getController()->getHUD()->setOwner(this->getControllableEntity()); 206 156 } 207 157 } -
code/branches/questsystem5/src/orxonox/objects/infos/HumanPlayer.h
r2907 r2908 51 51 void setClientID(unsigned int clientID); 52 52 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_; } 53 virtual void changedController(); 81 54 82 55 protected: … … 88 61 void networkcallback_client_initialized(); 89 62 90 void updateHumanHUD();91 void updateGametypeHUD();92 93 63 std::string nick_; 94 64 std::string synchronize_nick_; … … 96 66 bool server_initialized_; 97 67 bool client_initialized_; 98 99 std::string humanHudTemplate_;100 OverlayGroup* humanHud_;101 std::string gametypeHudTemplate_;102 OverlayGroup* gametypeHud_;103 68 }; 104 69 } -
code/branches/questsystem5/src/orxonox/objects/infos/PlayerInfo.cc
r2907 r2908 110 110 void PlayerInfo::createController() 111 111 { 112 if (this->controller_)113 {114 delete this->controller_;115 this->controller_ = 0;116 }117 112 this->controller_ = this->defaultController_.fabricate(this); 118 113 assert(this->controller_); … … 146 141 if (this->controller_) 147 142 this->controller_->setControllableEntity(entity); 148 149 this->changedControllableEntity();150 143 } 151 144 … … 162 155 if (callback) 163 156 entity->removePlayer(); 164 165 this->changedControllableEntity();166 157 } 167 158 } -
code/branches/questsystem5/src/orxonox/objects/infos/PlayerInfo.h
r2907 r2908 49 49 virtual void changedGametype(); 50 50 51 virtual void changedController() {}52 virtual void changedControllableEntity() {}53 54 51 inline bool isHumanPlayer() const 55 52 { return this->bHumanPlayer_; } … … 76 73 inline Controller* getController() const 77 74 { return this->controller_; } 75 virtual void changedController() {} 78 76 79 77 protected:
Note: See TracChangeset
for help on using the changeset viewer.