Changeset 5872 in orxonox.OLD for branches/spaceshipcontrol
- Timestamp:
- Dec 2, 2005, 3:06:50 PM (19 years ago)
- Location:
- branches/spaceshipcontrol/src/world_entities
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/spaceshipcontrol/src/world_entities/playable.cc
r5855 r5872 17 17 #include "playable.h" 18 18 19 19 20 Playable::Playable() 20 21 { … … 29 30 } 30 31 32 /** 33 * subscribe to all events the controllable needs 34 */ 35 void Playable::subscribeEvents(Player* player) 36 { 37 /*EventHandler*/ 38 evh = EventHandler::getInstance(); 39 for (int i = 0 ; i < events.size(); i++) 40 { 41 if (!evh->isSubscribed(ES_GAME, i)) 42 evh->subscribe(this, ES_GAME, i); 43 } 44 45 } 46 31 47 Playable::getWeaponManager() 32 48 { -
branches/spaceshipcontrol/src/world_entities/playable.h
r5864 r5872 13 13 class Weapon; 14 14 class WeaponManager; 15 class Player; 15 16 16 17 //! Basic controllable WorldEntity … … 30 31 virtual void addWeapon(Weapon* weapon )= 0; 31 32 virtual void removeWeapon(Weapon* weapon) = 0; 33 WeaponManager* getWeaponManager(); 32 34 35 void subscribeEvents(Player* player); 33 36 virtual void process(const Event &event) = 0; 34 37 virtual void setKeySet(); 35 38 inline const std::list<Event*>& getEventList() { return this->events; }; 36 WeaponManager* getWeaponManager(); 39 37 40 38 41 private: -
branches/spaceshipcontrol/src/world_entities/player.cc
r5853 r5872 56 56 } 57 57 58 /** 59 * subscribe to all events the controllable needs 60 */ 61 void Player::subscribeEvents() 62 { 63 /*EventHandler* evh = EventHandler::getInstance(); 64 for (int i = 1; i < SDLK_LAST; i++) 65 { 66 if (!evh->isSubscribed(ES_GAME, i)) 67 evh->subscribe(this, ES_GAME, i); 68 } 69 */ 70 } 58 71 59 72 60 void Player::process(const Event &event) … … 78 66 void Player::setControllable(Playable* controllalble) 79 67 { 80 //todo get keyset an subscribe to the needed keys 68 81 69 this->controllable = controllable; 70 this->controllable->subscribeEvents(this); 71 82 72 } 83 73 -
branches/spaceshipcontrol/src/world_entities/player.h
r5847 r5872 27 27 28 28 void init(); 29 void subscribeEvents(); 29 30 30 31 31 virtual void process(const Event &event); 32 32 33 33 void setControllable(Playable* controllalble); 34 void disconnectControllable(); 34 35 Playable* getControllable(); 35 36
Note: See TracChangeset
for help on using the changeset viewer.