- Timestamp:
- Sep 9, 2015, 2:15:46 PM (9 years ago)
- Location:
- code/branches/core7/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core7/src/libraries/core/BaseObject.cc
r10571 r10576 63 63 this->bActive_ = true; 64 64 this->bVisible_ = true; 65 this->oldGametype_ = 0;66 65 this->bRegisteredEventStates_ = false; 67 66 -
code/branches/core7/src/libraries/core/BaseObject.h
r10571 r10576 148 148 inline virtual uint32_t getSceneID() const { return this->sceneID_; } 149 149 150 inline void setGametype(const StrongPtr<Gametype>& gametype) 151 { 152 if (gametype != this->gametype_) 153 { 154 this->oldGametype_ = this->gametype_; 155 this->gametype_ = gametype; 156 this->changedGametype(); 157 } 158 } 150 inline void setGametype(const StrongPtr<Gametype>& gametype) { this->gametype_ = gametype; } 159 151 inline Gametype* getGametype() const { return this->gametype_; } 160 inline Gametype* getOldGametype() const { return this->oldGametype_; }161 virtual void changedGametype() {}162 152 163 153 inline void setLevel(const StrongPtr<Level>& level) { this->level_ = level; } … … 219 209 uint32_t sceneID_; 220 210 StrongPtr<Gametype> gametype_; 221 Gametype* oldGametype_;222 211 StrongPtr<Level> level_; 223 212 std::set<Template*> templates_; … … 235 224 SUPER_FUNCTION(4, BaseObject, XMLEventPort, false); 236 225 SUPER_FUNCTION(8, BaseObject, changedName, false); 237 SUPER_FUNCTION(9, BaseObject, changedGametype, false);238 226 } 239 227 -
code/branches/core7/src/libraries/core/class/Super.h
r9667 r10576 274 274 SUPER_NOARGS(classname, functionname) 275 275 276 #define SUPER_changedGametype(classname, functionname, ...) \277 SUPER_NOARGS(classname, functionname)278 279 276 #define SUPER_changedUsed(classname, functionname, ...) \ 280 277 SUPER_NOARGS(classname, functionname) … … 555 552 SUPER_FUNCTION_GLOBAL_DECLARATION_PART2; 556 553 557 SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(9, changedGametype, false) 558 () 559 SUPER_FUNCTION_GLOBAL_DECLARATION_PART2; 560 561 SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(10, changedUsed, false) 562 () 563 SUPER_FUNCTION_GLOBAL_DECLARATION_PART2; 564 565 SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(11, changedCarrier, false) 566 () 567 SUPER_FUNCTION_GLOBAL_DECLARATION_PART2; 568 569 SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(12, changedPickedUp, false) 554 SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(9, changedUsed, false) 555 () 556 SUPER_FUNCTION_GLOBAL_DECLARATION_PART2; 557 558 SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(10, changedCarrier, false) 559 () 560 SUPER_FUNCTION_GLOBAL_DECLARATION_PART2; 561 562 SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(11, changedPickedUp, false) 570 563 () 571 564 SUPER_FUNCTION_GLOBAL_DECLARATION_PART2; … … 623 616 SUPER_INTRUSIVE_DECLARATION(changedOverlayGroup); 624 617 SUPER_INTRUSIVE_DECLARATION(changedName); 625 SUPER_INTRUSIVE_DECLARATION(changedGametype);626 618 SUPER_INTRUSIVE_DECLARATION(changedUsed); 627 619 SUPER_INTRUSIVE_DECLARATION(changedCarrier); -
code/branches/core7/src/orxonox/Level.cc
r10575 r10576 169 169 { 170 170 orxout(internal_info) << "player entered level (id: " << player->getClientID() << ", name: " << player->getName() << ')' << endl; 171 player->s etGametype(this->getGametype());171 player->switchGametype(this->getGametype()); 172 172 } 173 173 … … 175 175 { 176 176 orxout(internal_info) << "player left level (id: " << player->getClientID() << ", name: " << player->getName() << ')' << endl; 177 player->s etGametype(0);177 player->switchGametype(0); 178 178 } 179 179 } -
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_; -
code/branches/core7/src/orxonox/interfaces/Pickupable.h
r9667 r10576 187 187 188 188 //! SUPER functions. 189 SUPER_FUNCTION( 10, Pickupable, changedUsed, false);190 SUPER_FUNCTION(1 1, Pickupable, changedCarrier, false);191 SUPER_FUNCTION(1 2, Pickupable, changedPickedUp, false);189 SUPER_FUNCTION(9, Pickupable, changedUsed, false); 190 SUPER_FUNCTION(10, Pickupable, changedCarrier, false); 191 SUPER_FUNCTION(11, Pickupable, changedPickedUp, false); 192 192 } 193 193
Note: See TracChangeset
for help on using the changeset viewer.