Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/network/src/world_entities/player.cc @ 5968

Last change on this file since 5968 was 5968, checked in by patrick, 18 years ago

network: merged the trunk into the network with the command svn merge -r5824:HEAD ../trunk network, changes changed… bla bla..

File size: 1.4 KB
RevLine 
[4592]1/*
[3471]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:
[5968]12   main-programmer: Silvan Nellen
13   co-programmer: Benjamin Knecht
[3471]14*/
15
16#include "player.h"
[5968]17#include "playable.h"
[3596]18
[4404]19#include "event_handler.h"
[4389]20
[3471]21using namespace std;
22
[4010]23
[3471]24/**
[4885]25 * creates a new Player
[3471]26*/
[4762]27Player::Player()
[3471]28{
[4780]29  this->init();
[3471]30}
31
[4975]32
[4010]33/**
[4975]34 *  destructs the player, deletes alocated memory
35 */
36Player::~Player ()
37{
38}
39
[5395]40
[4975]41/**
[4780]42 * initializes a Player
43 */
44void Player::init()
45{
[5037]46//  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
[4780]47  this->setClassID(CL_PLAYER, "Player");
[5144]48
[5300]49  PRINTF(4)("PLAYER INIT\n");
[4834]50
[5968]51  this->controllable = NULL;
[4780]52}
53
54
[5968]55bool Player::setControllable(Playable* controllable)
[4780]56{
[5968]57  if(controllable != NULL && controllable->subscribePlayer(this))
[5435]58  {
[5968]59      this->controllable = controllable;
60      return true;
[5829]61  }
[5750]62  else
[5968]63    return false;
[5435]64}
[5829]65
[5968]66bool Player::disconnectControllable()
67 {
68   if(this->controllable == NULL) return true;
[5829]69
[5968]70   if(this->controllable->unsubscribePlayer(this))
71   {
72     this->controllable = NULL;
73     return true;
74   }
75   else
76     return false;
77 }
[5829]78
[5968]79 void Player::process(const Event &event)
80 {
81   if (likely(this->controllable != NULL))
82     this->controllable->process(event);
83 }
[5829]84
Note: See TracBrowser for help on using the repository browser.