Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5881 in orxonox.OLD for branches


Ignore:
Timestamp:
Dec 3, 2005, 1:26:03 AM (19 years ago)
Author:
bensch
Message:

orxonox/branches/spaceshipcontroll: simple world-interactivity

Location:
branches/spaceshipcontrol/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/spaceshipcontrol/src/story_entities/world.cc

    r5851 r5881  
    316316          if( created != NULL) this->spawn( created);
    317317          // if we load a 'Player' we use it as localPlayer
     318
    318319          //todo do this more elegant
    319           if( element->Value() != NULL && !strcmp( element->Value(), "Player"))
    320           {
    321             localPlayer = (Player*) created;
    322           }
    323320          if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox")) sky = (SkyBox*) created;
    324321          if( element->Value() != NULL && !strcmp( element->Value(), "Terrain"))
     
    362359  /* GENERIC LOADING PROCESS FINISHED */
    363360
     361
     362  // Create a Player
     363  this->localPlayer = new Player();
     364  list<BaseObject*>* playableList = ClassList::getList(CL_PLAYABLE);
     365  if (playableList != NULL)
     366  {
     367    Playable* playable = dynamic_cast<Playable*>(playableList->front());
     368    if (playable != NULL)
     369      this->localPlayer->setControllable(playable);
     370  }
    364371  // bind input
    365372  EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_UP);
  • branches/spaceshipcontrol/src/world_entities/playable.cc

    r5877 r5881  
    1515
    1616#include "weapons/weapon_manager.h"
     17
    1718#include "playable.h"
    1819#include "event_handler.h"
     
    2728Playable::~Playable()
    2829{
    29 
     30  delete this->weaponMan;
    3031}
    3132
  • branches/spaceshipcontrol/src/world_entities/player.cc

    r5875 r5881  
    4949  PRINTF(4)("PLAYER INIT\n");
    5050
     51  this->controllable = NULL;
    5152}
    5253
     
    5556void Player::process(const Event &event)
    5657{
    57   this->controllable->process(event);
     58  if (likely(this->controllable != NULL))
     59    this->controllable->process(event);
    5860}
    5961
     
    6264 {
    6365
    64    this->controllable = controllable;
     66   this->controllable = controllalble;
    6567   this->controllable->subscribeEvents(this);
    6668
  • branches/spaceshipcontrol/src/world_entities/space_ships/space_ship.cc

    r5880 r5881  
    4040SpaceShip::SpaceShip()
    4141{
    42         this->init();
     42  this->init();
    4343}
    4444
Note: See TracChangeset for help on using the changeset viewer.