Changeset 10624 for code/trunk/src/orxonox/infos
- Timestamp:
- Oct 4, 2015, 9:12:21 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
-
code/trunk/src/orxonox/infos/GametypeInfo.cc
r9667 r10624 37 37 #include "core/GameMode.h" 38 38 #include "network/Host.h" 39 #include "network/NetworkFunction .h"39 #include "network/NetworkFunctionIncludes.h" 40 40 #include "util/Convert.h" 41 41 … … 369 369 this->changedReadyToSpawn(ready); 370 370 else 371 callMemberNetworkFunction( GametypeInfo,changedReadyToSpawn, this->getObjectID(), player->getClientID(), ready);371 callMemberNetworkFunction(&GametypeInfo::changedReadyToSpawn, this->getObjectID(), player->getClientID(), ready); 372 372 } 373 373 } … … 388 388 this->changedSpawned(spawned); 389 389 else 390 callMemberNetworkFunction( GametypeInfo,changedSpawned, this->getObjectID(), player->getClientID(), spawned);390 callMemberNetworkFunction(&GametypeInfo::changedSpawned, this->getObjectID(), player->getClientID(), spawned); 391 391 } 392 392 } … … 399 399 if (GameMode::isMaster()) 400 400 { 401 callMemberNetworkFunction( GametypeInfo,dispatchAnnounceMessage, this->getObjectID(), NETWORK_PEER_ID_BROADCAST, message);401 callMemberNetworkFunction(&GametypeInfo::dispatchAnnounceMessage, this->getObjectID(), NETWORK_PEER_ID_BROADCAST, message); 402 402 this->dispatchAnnounceMessage(message); 403 403 } … … 411 411 this->dispatchAnnounceMessage(message); 412 412 else 413 callMemberNetworkFunction( GametypeInfo,dispatchAnnounceMessage, this->getObjectID(), clientID, message);413 callMemberNetworkFunction(&GametypeInfo::dispatchAnnounceMessage, this->getObjectID(), clientID, message); 414 414 } 415 415 } … … 422 422 this->dispatchKillMessage(message); 423 423 else 424 callMemberNetworkFunction( GametypeInfo,dispatchKillMessage, this->getObjectID(), clientID, message);424 callMemberNetworkFunction(&GametypeInfo::dispatchKillMessage, this->getObjectID(), clientID, message); 425 425 } 426 426 } … … 433 433 this->dispatchDeathMessage(message); 434 434 else 435 callMemberNetworkFunction( GametypeInfo,dispatchDeathMessage, this->getObjectID(), clientID, message);435 callMemberNetworkFunction(&GametypeInfo::dispatchDeathMessage, this->getObjectID(), clientID, message); 436 436 } 437 437 } … … 444 444 this->dispatchStaticMessage(message, colour); 445 445 else 446 callMemberNetworkFunction( GametypeInfo,dispatchStaticMessage, this->getObjectID(), clientID, message, colour);446 callMemberNetworkFunction(&GametypeInfo::dispatchStaticMessage, this->getObjectID(), clientID, message, colour); 447 447 } 448 448 } … … 455 455 this->dispatchFadingMessage(message); 456 456 else 457 callMemberNetworkFunction( GametypeInfo,dispatchFadingMessage, this->getObjectID(), clientID, message);457 callMemberNetworkFunction(&GametypeInfo::dispatchFadingMessage, this->getObjectID(), clientID, message); 458 458 } 459 459 } -
code/trunk/src/orxonox/infos/HumanPlayer.cc
r9667 r10624 160 160 } 161 161 162 void HumanPlayer:: changedGametype()163 { 164 PlayerInfo:: changedGametype();162 void HumanPlayer::switchGametype(Gametype* gametype) 163 { 164 PlayerInfo::switchGametype(gametype); 165 165 166 166 if (this->isInitialized() && this->isLocalPlayer()) -
code/trunk/src/orxonox/infos/HumanPlayer.h
r9667 r10624 51 51 void setClientID(unsigned int clientID); 52 52 53 virtual void changedGametype();53 virtual void switchGametype(Gametype* gametype); 54 54 55 55 inline void setHumanHUDTemplate(const std::string& name) -
code/trunk/src/orxonox/infos/PlayerInfo.cc
r9945 r10624 40 40 namespace orxonox 41 41 { 42 RegisterAbstractClass(PlayerInfo).inheritsFrom (Class(Info));42 RegisterAbstractClass(PlayerInfo).inheritsFrom<Info>(); 43 43 44 44 PlayerInfo::PlayerInfo(Context* context) : Info(context) … … 57 57 this->gtinfo_ = 0; 58 58 this->gtinfoID_ = OBJECTID_UNKNOWN; 59 this->updateGametypeInfo( );59 this->updateGametypeInfo(this->getGametype()); 60 60 61 61 this->registerVariables(); … … 95 95 } 96 96 97 void PlayerInfo::changedGametype() 98 { 99 this->updateGametypeInfo(); 97 void PlayerInfo::switchGametype(Gametype* gametype) 98 { 99 Gametype* oldGametype = this->getGametype(); 100 this->setGametype(StrongPtr<Gametype>(gametype)); 101 Gametype* newGametype = this->getGametype(); 102 103 104 this->updateGametypeInfo(newGametype); 100 105 101 106 if (this->isInitialized()) 102 107 { 103 if ( this->getOldGametype())108 if (oldGametype) 104 109 { 105 if ( this->getGametype())106 this->getOldGametype()->playerSwitched(this, this->getGametype());110 if (newGametype) 111 oldGametype->playerSwitched(this, newGametype); 107 112 else 108 this->getOldGametype()->playerLeft(this);113 oldGametype->playerLeft(this); 109 114 } 110 115 111 if ( this->getGametype())116 if (newGametype) 112 117 { 113 if ( this->getOldGametype())114 this->getGametype()->playerSwitchedBack(this, this->getOldGametype());118 if (oldGametype) 119 newGametype->playerSwitchedBack(this, oldGametype); 115 120 else 116 this->getGametype()->playerEntered(this);121 newGametype->playerEntered(this); 117 122 } 118 123 } 119 124 } 120 125 121 void PlayerInfo::updateGametypeInfo( )126 void PlayerInfo::updateGametypeInfo(Gametype* gametype) 122 127 { 123 128 this->gtinfo_ = 0; 124 129 this->gtinfoID_ = OBJECTID_UNKNOWN; 125 130 126 if ( this->getGametype() && this->getGametype()->getGametypeInfo())127 { 128 this->gtinfo_ = this->getGametype()->getGametypeInfo();131 if (gametype && gametype->getGametypeInfo()) 132 { 133 this->gtinfo_ = gametype->getGametypeInfo(); 129 134 this->gtinfoID_ = this->gtinfo_->getObjectID(); 130 135 } … … 186 191 187 192 this->controllableEntity_->destroyHud(); // HACK-ish 188 this->previousControllableEntity_.push_back( WeakPtr<ControllableEntity>(this->controllableEntity_));193 this->previousControllableEntity_.push_back(this->controllableEntity_); 189 194 this->controllableEntity_ = entity; 190 195 this->controllableEntityID_ = entity->getObjectID(); -
code/trunk/src/orxonox/infos/PlayerInfo.h
r9667 r10624 45 45 46 46 virtual void changedName(); 47 virtual void changedGametype();47 virtual void switchGametype(Gametype* gametype); 48 48 49 49 virtual void changedController() {} … … 94 94 void networkcallback_changedcontrollableentityID(); 95 95 void networkcallback_changedgtinfoID(); 96 void updateGametypeInfo( );96 void updateGametypeInfo(Gametype* gametype); 97 97 98 98 bool bReadyToSpawn_;
Note: See TracChangeset
for help on using the changeset viewer.