Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/spaceshipcontrol/src/world_entities/playable.cc @ 5894

Last change on this file since 5894 was 5889, checked in by snellen, 19 years ago

registerEvent in Playable.cc implemented

File size: 1.2 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11### File Specific:
12   main-programmer: Silvan Nellen
13   co-programmer: Benjamin Knecht
14*/
15
16#include "weapons/weapon_manager.h"
17
18#include "playable.h"
19#include "event_handler.h"
20#include "player.h"
21
22
23Playable::Playable()
24{
25  this->init();
26}
27
28Playable::~Playable()
29{
30  delete this->weaponMan;
31}
32
33void Playable::init()
34{
35  this->setClassID(CL_PLAYABLE, "Playable");
36  PRINTF(4)("PLAYABLE INIT\n");
37  this->weaponMan = new WeaponManager(this);
38}
39
40/**
41 * subscribe to all events the controllable needs
42 */
43void Playable::subscribeEvents(Player* player)
44{
45  /*EventHandler*/
46  EventHandler* evh = EventHandler::getInstance();
47  std::list<int>::iterator ev;
48  for (ev = this->events.begin(); ev != events.end(); ev++)
49  {
50    evh->subscribe(player, ES_GAME, (*ev));
51  }
52
53}
54
55/**
56 * add an event to the event list
57 */
58 void Playable::registerEvent(int eventType)
59{
60  this->events.push_back(eventType);
61
62}
63
64
65
Note: See TracBrowser for help on using the repository browser.