Changeset 5895 in orxonox.OLD for branches/spaceshipcontrol/src/world_entities/playable.cc
- Timestamp:
- Dec 3, 2005, 5:18:37 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/spaceshipcontrol/src/world_entities/playable.cc
r5889 r5895 14 14 */ 15 15 16 #include "weapons/weapon_manager.h"17 16 18 17 #include "playable.h" 18 19 #include "weapons/weapon_manager.h" 19 20 #include "event_handler.h" 20 21 #include "player.h" … … 29 30 { 30 31 delete this->weaponMan; 32 33 if (this->currentPlayer) 34 { 35 PRINTF(2)("There is Still a Player subscribed to this Playable (%s::%s)\n", this->getClassName(), this->getName()); 36 37 } 31 38 } 32 39 … … 36 43 PRINTF(4)("PLAYABLE INIT\n"); 37 44 this->weaponMan = new WeaponManager(this); 45 46 this->currentPlayer = NULL; 38 47 } 39 48 … … 41 50 * subscribe to all events the controllable needs 42 51 */ 43 void Playable::subscribeEvents(Player* player)52 bool Playable::subscribePlayer(Player* player) 44 53 { 45 /*EventHandler*/ 46 EventHandler* evh = EventHandler::getInstance(); 47 std::list<int>::iterator ev; 48 for (ev = this->events.begin(); ev != events.end(); ev++) 54 if (this->currentPlayer != NULL) 49 55 { 50 evh->subscribe(player, ES_GAME, (*ev)); 56 PRINTF(1)("Already registered Player:%s to this Playable (%s:%s)\n", this->currentPlayer->getName(), this->getClassName(), this->getName()); 57 return false; 51 58 } 59 else 60 { 61 this->currentPlayer = player; 62 /*EventHandler*/ 63 EventHandler* evh = EventHandler::getInstance(); 64 std::list<int>::iterator ev; 65 for (ev = this->events.begin(); ev != events.end(); ev++) 66 evh->subscribe(player, ES_GAME, (*ev)); 52 67 68 return true; 69 } 53 70 } 54 71
Note: See TracChangeset
for help on using the changeset viewer.