Changeset 6417 for code/trunk/src/orxonox/infos
- Timestamp:
- Dec 25, 2009, 10:23:58 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/infos/Bot.cc
r5781 r6417 94 94 static std::vector<std::string> defaultnames(names, names + sizeof(names) / sizeof(std::string)); 95 95 96 SetConfigValue Vector(names_, defaultnames);96 SetConfigValue(names_, defaultnames); 97 97 } 98 98 } -
code/trunk/src/orxonox/infos/HumanPlayer.cc
r5929 r6417 35 35 #include "network/Host.h" 36 36 #include "controllers/HumanController.h" 37 #include "controllers/NewHumanController.h" 37 38 #include "gametypes/Gametype.h" 38 39 #include "overlays/OverlayGroup.h" … … 50 51 51 52 this->bHumanPlayer_ = true; 52 this->defaultController_ = Class( HumanController);53 this->defaultController_ = Class(NewHumanController); 53 54 54 55 this->humanHud_ = 0; … … 163 164 if (this->isInitialized() && this->isLocalPlayer()) 164 165 { 165 if (this->getGametype() && this->getGametype()->getHUDTemplate() != "")166 if (this->getGametype() && !this->getGametype()->getHUDTemplate().empty()) 166 167 this->setGametypeHUDTemplate(this->getGametype()->getHUDTemplate()); 167 168 else … … 178 179 } 179 180 180 if (this->isLocalPlayer() && this->humanHudTemplate_ != ""&& GameMode::showsGraphics())181 if (this->isLocalPlayer() && !this->humanHudTemplate_.empty() && GameMode::showsGraphics()) 181 182 { 182 183 this->humanHud_ = new OverlayGroup(this); … … 194 195 } 195 196 196 if (this->isLocalPlayer() && this->gametypeHudTemplate_ != "")197 if (this->isLocalPlayer() && !this->gametypeHudTemplate_.empty()) 197 198 { 198 199 this->gametypeHud_ = new OverlayGroup(this); -
code/trunk/src/orxonox/infos/PlayerInfo.cc
r5929 r6417 50 50 this->controller_ = 0; 51 51 this->controllableEntity_ = 0; 52 this->controllableEntityID_ = CLIENTID_UNKNOWN; 52 this->controllableEntityID_ = OBJECTID_UNKNOWN; 53 this->oldControllableEntity_ = 0; 53 54 54 55 this->gtinfo_ = 0; … … 80 81 registerVariable(this->name_, VariableDirection::ToClient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::changedName)); 81 82 registerVariable(this->controllableEntityID_, VariableDirection::ToClient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedcontrollableentityID)); 82 registerVariable(this->bReadyToSpawn_, VariableDirection::ToServer);83 83 registerVariable(this->gtinfoID_, VariableDirection::ToClient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedgtinfoID)); 84 84 } … … 139 139 this->controller_->setPlayer(this); 140 140 if (this->controllableEntity_) 141 { 141 142 this->controller_->setControllableEntity(this->controllableEntity_); 143 this->controllableEntity_->setController(this->controller_); 144 } 142 145 this->changedController(); 143 146 } … … 148 151 return; 149 152 153 if (this->oldControllableEntity_) 154 this->stopTemporaryControl(); 150 155 if (this->controllableEntity_) 151 156 this->stopControl(); … … 159 164 160 165 if (this->controller_) 166 { 161 167 this->controller_->setControllableEntity(entity); 168 this->controllableEntity_->setController(this->controller_); 169 } 170 171 this->changedControllableEntity(); 172 } 173 174 void PlayerInfo::startTemporaryControl(ControllableEntity* entity) 175 { 176 if (!entity) 177 return; 178 179 // assert( this->temporaryControllableEntity_==0 ); 180 181 this->oldControllableEntity_ = this->controllableEntity_; 182 this->controllableEntity_ = entity; 183 this->controllableEntityID_ = entity->getObjectID(); 184 185 entity->setPlayer(this); 186 187 if (this->controller_) 188 this->controller_->setControllableEntity(entity); 162 189 163 190 this->changedControllableEntity(); … … 166 193 void PlayerInfo::stopControl() 167 194 { 195 if ( this->oldControllableEntity_ ) 196 this->stopTemporaryControl(); 197 168 198 ControllableEntity* entity = this->controllableEntity_; 169 199 … … 171 201 return; 172 202 203 this->controllableEntity_->setController(0); 173 204 this->controllableEntity_ = 0; 174 205 this->controllableEntityID_ = OBJECTID_UNKNOWN; … … 177 208 this->controller_->setControllableEntity(0); 178 209 179 entity->removePlayer(); 210 if ( GameMode::isMaster() ) 211 entity->removePlayer(); 212 213 this->changedControllableEntity(); 214 } 215 216 void PlayerInfo::stopTemporaryControl() 217 { 218 ControllableEntity* entity = this->controllableEntity_; 219 220 assert( this->controllableEntity_ && this->oldControllableEntity_ ); 221 if( !entity || !this->oldControllableEntity_ ) 222 return; 223 224 this->controllableEntity_ = this->oldControllableEntity_; 225 this->controllableEntityID_ = this->controllableEntity_->getObjectID(); 226 this->oldControllableEntity_ = 0; 227 228 if ( this->controllableEntity_ && this->controller_) 229 this->controller_->setControllableEntity(this->controllableEntity_); 230 231 if ( GameMode::isMaster() ) 232 entity->removePlayer(); 180 233 181 234 this->changedControllableEntity(); … … 196 249 } 197 250 251 198 252 void PlayerInfo::networkcallback_changedgtinfoID() 199 253 { -
code/trunk/src/orxonox/infos/PlayerInfo.h
r5929 r6417 69 69 void startControl(ControllableEntity* entity); 70 70 void stopControl(); 71 void startTemporaryControl(ControllableEntity* entity); 72 void stopTemporaryControl(); 71 73 72 74 inline ControllableEntity* getControllableEntity() const … … 96 98 Controller* controller_; 97 99 ControllableEntity* controllableEntity_; 100 ControllableEntity* oldControllableEntity_; 98 101 unsigned int controllableEntityID_; 99 102
Note: See TracChangeset
for help on using the changeset viewer.