Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

orxonox/branches/spaceshipcontroll: simple world-interactivity

File:
1 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);
Note: See TracChangeset for help on using the changeset viewer.