Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

registerEvent in Playable.cc implemented

File size: 1.2 KB
RevLine 
[5838]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:
[5841]12   main-programmer: Silvan Nellen
13   co-programmer: Benjamin Knecht
[5838]14*/
15
[5875]16#include "weapons/weapon_manager.h"
[5881]17
[5838]18#include "playable.h"
[5875]19#include "event_handler.h"
20#include "player.h"
[5838]21
[5872]22
[5838]23Playable::Playable()
24{
25  this->init();
26}
27
[5875]28Playable::~Playable()
[5838]29{
[5881]30  delete this->weaponMan;
[5875]31}
32
33void Playable::init()
34{
[5838]35  this->setClassID(CL_PLAYABLE, "Playable");
36  PRINTF(4)("PLAYABLE INIT\n");
37  this->weaponMan = new WeaponManager(this);
38}
39
[5872]40/**
41 * subscribe to all events the controllable needs
42 */
43void Playable::subscribeEvents(Player* player)
44{
45  /*EventHandler*/
[5875]46  EventHandler* evh = EventHandler::getInstance();
[5877]47  std::list<int>::iterator ev;
[5876]48  for (ev = this->events.begin(); ev != events.end(); ev++)
[5872]49  {
[5877]50    evh->subscribe(player, ES_GAME, (*ev));
[5875]51  }
[5872]52
53}
[5889]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.