- Timestamp:
- Apr 8, 2009, 12:58:47 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
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 }
Note: See TracChangeset
for help on using the changeset viewer.