Changeset 2907 for code/branches/questsystem5/src/orxonox/objects/infos
- Timestamp:
- Apr 8, 2009, 12:36:08 AM (16 years ago)
- Location:
- code/branches/questsystem5
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/questsystem5
- Property svn:mergeinfo changed
-
code/branches/questsystem5/src/orxonox/objects/infos/Bot.cc
r2662 r2907 30 30 #include "Bot.h" 31 31 32 #include "core/ Core.h"32 #include "core/GameMode.h" 33 33 #include "core/CoreIncludes.h" 34 34 #include "core/ConfigValueIncludes.h" … … 46 46 47 47 this->bHumanPlayer_ = false; 48 this->bLocalPlayer_ = Core::isMaster();48 this->bLocalPlayer_ = GameMode::isMaster(); 49 49 this->bSetUnreadyAfterSpawn_ = false; 50 50 this->setReadyToSpawn(true); -
code/branches/questsystem5/src/orxonox/objects/infos/CMakeLists.txt
r2710 r2907 1 1 ADD_SOURCE_FILES(ORXONOX_SRC_FILES 2 2 Bot.cc 3 PongBot.cc 3 4 Info.cc 4 5 PlayerInfo.cc -
code/branches/questsystem5/src/orxonox/objects/infos/GametypeInfo.cc
r2662 r2907 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/branches/questsystem5/src/orxonox/objects/infos/GametypeInfo.h
r2662 r2907 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/branches/questsystem5/src/orxonox/objects/infos/HumanPlayer.cc
r2662 r2907 30 30 #include "HumanPlayer.h" 31 31 32 #include "core/ Core.h"32 #include "core/GameMode.h" 33 33 #include "core/CoreIncludes.h" 34 34 #include "core/ConfigValueIncludes.h" … … 47 47 RegisterObject(HumanPlayer); 48 48 49 this->server_initialized_ = Core::isMaster();49 this->server_initialized_ = GameMode::isMaster(); 50 50 this->client_initialized_ = false; 51 51 … … 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 … … 82 93 this->synchronize_nick_ = this->nick_; 83 94 84 if ( Core::isMaster())95 if (GameMode::isMaster()) 85 96 this->setName(this->nick_); 86 97 } … … 89 100 void HumanPlayer::configvaluecallback_changedHUDTemplate() 90 101 { 91 this-> changedController();102 this->setHumanHUDTemplate(this->hudtemplate_); 92 103 } 93 104 … … 105 116 this->client_initialized_ = true; 106 117 107 if (! Core::isMaster())118 if (!GameMode::isMaster()) 108 119 this->setObjectMode(objectDirection::bidirectional); 109 120 else … … 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 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()); 156 206 } 157 207 } -
code/branches/questsystem5/src/orxonox/objects/infos/HumanPlayer.h
r2662 r2907 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/branches/questsystem5/src/orxonox/objects/infos/PlayerInfo.cc
r2662 r2907 110 110 void PlayerInfo::createController() 111 111 { 112 if (this->controller_) 113 { 114 delete this->controller_; 115 this->controller_ = 0; 116 } 112 117 this->controller_ = this->defaultController_.fabricate(this); 113 118 assert(this->controller_); … … 141 146 if (this->controller_) 142 147 this->controller_->setControllableEntity(entity); 148 149 this->changedControllableEntity(); 143 150 } 144 151 … … 155 162 if (callback) 156 163 entity->removePlayer(); 164 165 this->changedControllableEntity(); 157 166 } 158 167 } -
code/branches/questsystem5/src/orxonox/objects/infos/PlayerInfo.h
r2662 r2907 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.