Changeset 5881 in orxonox.OLD for branches/spaceshipcontrol/src
- Timestamp:
- Dec 3, 2005, 1:26:03 AM (19 years ago)
- Location:
- branches/spaceshipcontrol/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/spaceshipcontrol/src/story_entities/world.cc
r5851 r5881 316 316 if( created != NULL) this->spawn( created); 317 317 // if we load a 'Player' we use it as localPlayer 318 318 319 //todo do this more elegant 319 if( element->Value() != NULL && !strcmp( element->Value(), "Player"))320 {321 localPlayer = (Player*) created;322 }323 320 if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox")) sky = (SkyBox*) created; 324 321 if( element->Value() != NULL && !strcmp( element->Value(), "Terrain")) … … 362 359 /* GENERIC LOADING PROCESS FINISHED */ 363 360 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 } 364 371 // bind input 365 372 EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_UP); -
branches/spaceshipcontrol/src/world_entities/playable.cc
r5877 r5881 15 15 16 16 #include "weapons/weapon_manager.h" 17 17 18 #include "playable.h" 18 19 #include "event_handler.h" … … 27 28 Playable::~Playable() 28 29 { 29 30 delete this->weaponMan; 30 31 } 31 32 -
branches/spaceshipcontrol/src/world_entities/player.cc
r5875 r5881 49 49 PRINTF(4)("PLAYER INIT\n"); 50 50 51 this->controllable = NULL; 51 52 } 52 53 … … 55 56 void Player::process(const Event &event) 56 57 { 57 this->controllable->process(event); 58 if (likely(this->controllable != NULL)) 59 this->controllable->process(event); 58 60 } 59 61 … … 62 64 { 63 65 64 this->controllable = controlla ble;66 this->controllable = controllalble; 65 67 this->controllable->subscribeEvents(this); 66 68 -
branches/spaceshipcontrol/src/world_entities/space_ships/space_ship.cc
r5880 r5881 40 40 SpaceShip::SpaceShip() 41 41 { 42 42 this->init(); 43 43 } 44 44
Note: See TracChangeset
for help on using the changeset viewer.