Changeset 10576 for code/branches/core7/src/orxonox/infos
- Timestamp:
- Sep 9, 2015, 2:15:46 PM (9 years ago)
- Location:
- code/branches/core7/src/orxonox/infos
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core7/src/orxonox/infos/HumanPlayer.cc
r9667 r10576 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/branches/core7/src/orxonox/infos/HumanPlayer.h
r9667 r10576 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/branches/core7/src/orxonox/infos/PlayerInfo.cc
r10557 r10576 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(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 } -
code/branches/core7/src/orxonox/infos/PlayerInfo.h
r9667 r10576 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.