- Timestamp:
- Apr 8, 2009, 12:36:08 AM (15 years ago)
- Location:
- code/branches/questsystem5
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/questsystem5
- Property svn:mergeinfo changed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.