Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5872 in orxonox.OLD for branches/spaceshipcontrol


Ignore:
Timestamp:
Dec 2, 2005, 3:06:50 PM (19 years ago)
Author:
snellen
Message:

player.cc and player.h updated ( in ../src/world_entities)

Location:
branches/spaceshipcontrol/src/world_entities
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/spaceshipcontrol/src/world_entities/playable.cc

    r5855 r5872  
    1717#include "playable.h"
    1818
     19
    1920Playable::Playable()
    2021{
     
    2930}
    3031
     32/**
     33 * subscribe to all events the controllable needs
     34 */
     35void 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
    3147Playable::getWeaponManager()
    3248{
  • branches/spaceshipcontrol/src/world_entities/playable.h

    r5864 r5872  
    1313class Weapon;
    1414class WeaponManager;
     15class Player;
    1516
    1617//! Basic controllable WorldEntity
     
    3031    virtual void addWeapon(Weapon* weapon )= 0;
    3132    virtual void removeWeapon(Weapon* weapon) = 0;
     33    WeaponManager* getWeaponManager();
    3234
     35    void subscribeEvents(Player* player);
    3336    virtual void process(const Event &event) = 0;
    3437    virtual void setKeySet();
    3538    inline const std::list<Event*>& getEventList() { return this->events; };
    36     WeaponManager* getWeaponManager();
     39
    3740
    3841  private:
  • branches/spaceshipcontrol/src/world_entities/player.cc

    r5853 r5872  
    5656}
    5757
    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
    7159
    7260void Player::process(const Event &event)
     
    7866void Player::setControllable(Playable* controllalble)
    7967 {
    80    //todo get keyset an subscribe to the needed keys
     68
    8169   this->controllable = controllable;
     70   this->controllable->subscribeEvents(this);
     71
    8272 }
    8373
  • branches/spaceshipcontrol/src/world_entities/player.h

    r5847 r5872  
    2727
    2828    void          init();
    29     void          subscribeEvents();
     29
    3030
    3131    virtual void  process(const Event &event);
    3232
    3333    void          setControllable(Playable* controllalble);
     34    void          disconnectControllable();
    3435    Playable*     getControllable();
    3536
Note: See TracChangeset for help on using the changeset viewer.