Index: branches/powerups/src/story_entities/world.cc
===================================================================
--- branches/powerups/src/story_entities/world.cc	(revision 5848)
+++ branches/powerups/src/story_entities/world.cc	(revision 5955)
@@ -26,5 +26,4 @@
 #include "null_parent.h"
 #include "pilot_node.h"
-#include "track_node.h"
 #include "world_entity.h"
 #include "player.h"
@@ -40,5 +39,4 @@
 #include "shell.h"
 
-#include "track_manager.h"
 #include "garbage_collector.h"
 #include "fast_factory.h"
@@ -63,5 +61,4 @@
 #include "weapons/projectile.h"
 #include "event_handler.h"
-
 #include "sound_engine.h"
 #include "ogg_player.h"
@@ -72,4 +69,6 @@
 #include "npcs/npc_test1.h"
 #include "shader.h"
+
+#include "playable.h"
 
 SHELL_COMMAND(speed, World, setSpeed);
@@ -122,13 +121,14 @@
   PRINTF(3)("World::~World() - deleting current world\n");
 
+
   // here everything that is alocated by the World is deleted
   delete this->entities;
   State::setWorldEntityList(NULL);
 
+  delete this->localPlayer;
 
   // delete all the initialized Engines.
   FastFactory::flushAll(true);
   delete LightManager::getInstance();
-  delete TrackManager::getInstance();
   delete ParticleEngine::getInstance();
   delete AnimationPlayer::getInstance();
@@ -142,4 +142,5 @@
   // erease everything that is left.
   delete NullParent::getInstance();
+
   Shader::suspendShader();
 
@@ -172,4 +173,6 @@
   this->shell = NULL;
   this->entities = NULL;
+  this->localPlayer = NULL;
+  this->localCamera = NULL;
 
   this->showPNodes = false;
@@ -213,4 +216,5 @@
 
   AnimationPlayer::getInstance(); // initializes the animationPlayer
+  ParticleEngine::getInstance();
   PhysicsEngine::getInstance();
 
@@ -242,10 +246,10 @@
     }
 
-  TiXmlDocument* XMLDoc = new TiXmlDocument( path);
+  TiXmlDocument* XMLDoc = new TiXmlDocument( getPath());
   // load the campaign document
   if( !XMLDoc->LoadFile())
   {
     // report an error
-    PRINTF(1)("loading XML File: %s @ %d:%d\n", XMLDoc->ErrorDesc(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
+    PRINTF(1)("loading XML File: %s @ %s:l%d:c%d\n", XMLDoc->ErrorDesc(), this->getPath(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
     delete XMLDoc;
     return (ErrorMessage){213,"XML File parsing error","World::load()"};
@@ -313,17 +317,21 @@
       while( element != NULL)
         {
-          WorldEntity* created = dynamic_cast<WorldEntity*>( loader->fabricate( element));
-          if( created != NULL) this->spawn( created);
+          BaseObject* created = (loader->fabricate(element));
+          if( created != NULL )
+          {
+            if(created->isA(CL_WORLD_ENTITY))
+              this->spawn(dynamic_cast<WorldEntity*>(created));
+            printf("Created a %s: %s\n", created->getClassName(), created->getName());
+          }
+
           // if we load a 'Player' we use it as localPlayer
+
+
           //todo do this more elegant
-          if( element->Value() != NULL && !strcmp( element->Value(), "Player"))
-          {
-            localPlayer = (Player*) created;
-            CDEngine::getInstance()->setPlayer(localPlayer);
-          }
-          if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox")) sky = (SkyBox*) created;
+          if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox"))
+            sky = dynamic_cast<SkyBox*>(created);
           if( element->Value() != NULL && !strcmp( element->Value(), "Terrain"))
           {
-            terrain = (Terrain*) created;
+            terrain = dynamic_cast<Terrain*>(created);
             CDEngine::getInstance()->setTerrain(terrain);
           }
@@ -340,21 +348,6 @@
     LoadParamXML(root, "LightManager", LightManager::getInstance(), LightManager, loadParams);
 
-    LoadParamXML(root, "ParticleEngine", ParticleEngine::getInstance(), ParticleEngine, loadParams);
-    LoadParamXML(root, "PhysicsEngine", PhysicsEngine::getInstance(), PhysicsEngine, loadParams);
-
-  // find Track
-  element = root->FirstChildElement( "Track");
-  if( element == NULL)
-    {
-      PRINTF(0)("World is missing a 'Track'\n");
-    }
-  else
-    {
-      //load track
-      PRINTF(4)("Loading Track\n");
-
-      TrackManager::getInstance()->loadParams( element);
-      TrackManager::getInstance()->finalize();
-    }
+   LoadParamXML(root, "ParticleEngine", ParticleEngine::getInstance(), ParticleEngine, loadParams);
+//   LoadParamXML(root, "PhysicsEngine", PhysicsEngine::getInstance(), PhysicsEngine, loadParams);
 
   // free the XML data
@@ -363,31 +356,24 @@
   /* GENERIC LOADING PROCESS FINISHED */
 
-  // bind input
-  EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_UP);
-  EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_DOWN);
-  EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_LEFT);
-  EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_RIGHT);
-  EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_FIRE1);
-  EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_NEXT_WEAPON);
-  EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_PREVIOUS_WEAPON);
-  EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, SDLK_PAGEUP);
-  EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, SDLK_PAGEDOWN);
+
+  // Create a Player
+  this->localPlayer = new Player();
+
+  Playable* playable;
+  const list<BaseObject*>* playableList = ClassList::getList(CL_PLAYABLE);
+  if (playableList != NULL)
+  {
+    playable = dynamic_cast<Playable*>(playableList->front());
+    this->localPlayer->setControllable(playable);
+  }
 
   // bind camera
-  //this->localCamera->bind (localPlayer);
- // this->localPlayer->addChild (this->localCamera);
-
-
-  //        TrackManager::getInstance()->setBindSlave(env);
-  PNode* tn = TrackManager::getInstance()->getTrackNode();
-  tn->addChild(this->localPlayer);
-
-  //localCamera->setParent(TrackNode::getInstance());
-  tn->addChild(this->localCamera);
-  localCamera->lookAt(tn);
+  playable->addChild (this->localCamera);
+
+//   //localCamera->setParent(TrackNode::getInstance());
+//  tn->addChild(this->localCamera);
   localCamera->setClipRegion(1, 10000.0);
-  this->localPlayer->setParentMode(PNODE_ALL);
-  TrackManager::getInstance()->condition(1, LEFTRIGHT, this->localPlayer);
-
+  localCamera->lookAt(playable);
+//  this->localPlayer->setParentMode(PNODE_ALL);
   if (sky != NULL)
   {
@@ -400,6 +386,4 @@
   glNewList (objectList, GL_COMPILE);
 
-  //TrackManager::getInstance()->drawGraph(.01);
-  //TrackManager::getInstance()->debug(2);
   glEndList();
 
@@ -412,11 +396,4 @@
   ////////////
 
-  Gravity* test = new Gravity();
-
-  // SYSTEM TRAILING THE PLAYER
-  // Creating a Test Particle System
-
-  //new PhysicsConnection(system, gravity);
-  //    new PhysicsConnection(this->localPlayer, gravity);
 
 //   TestEntity* testEntity = new TestEntity();
@@ -424,47 +401,4 @@
 //   testEntity->setRelDir(Quaternion(M_PI, Vector(0, 1, 0)));
 //   this->spawn(testEntity);
-
-//   TestEntity* testEntity2 = new TestEntity();
-//   testEntity2->setAnim(STAND);
-//   testEntity2->setRelCoor(Vector(2400.0, 10.0, -30.0));
-//   testEntity2->setRelDir(Quaternion(M_PI, Vector(0, 1, 0)));
-//   //testEntity2->setParent(this->localPlayer);
-//   this->spawn(testEntity2);
-//
-//   TestEntity* testEntity3 = new TestEntity();
-//   testEntity3->setAnim(BOOM);
-//   testEntity3->setRelCoor(Vector(2450.0, 10.0, -40.0));
-//   testEntity3->setRelDir(Quaternion(M_PI, Vector(0, 1, 0)));
-//   this->spawn(testEntity3);
-//
-//   TestEntity* testEntity4 = new TestEntity();
-//   testEntity4->setAnim(FLIP);
-//   testEntity4->setRelCoor(Vector(2500.0, 10.0, -22.0));
-//   testEntity4->setRelDir(Quaternion(M_PI, Vector(0, 1, 0)));
-//   this->spawn(testEntity4);
-//
-//   TestEntity* testEntity5 = new TestEntity();
-//   testEntity5->setAnim(WAVE);
-//   testEntity5->setRelCoor(Vector(2420.0, 10.0, -50.0));
-//   testEntity5->setRelDir(Quaternion(M_PI, Vector(0, 1, 0)));
-//   this->spawn(testEntity5);
-//
-//   TestEntity* testEntity6 = new TestEntity();
-//   testEntity6->setAnim(WAVE);
-//   testEntity6->setRelCoor(Vector(2420.0, 10.0, -20.0));
-//   testEntity6->setRelDir(Quaternion(M_PI, Vector(0, 1, 0)));
-//   this->spawn(testEntity6);
-//
-//   TestEntity* testEntity7 = new TestEntity();
-//   testEntity7->setAnim(WAVE);
-//   testEntity7->setRelCoor(Vector(2500.0, 10.0, -50.0));
-//   testEntity7->setRelDir(Quaternion(M_PI, Vector(0, 1, 0)));
-//   this->spawn(testEntity7);
-
-
-
-//  PhysicsEngine::getInstance()->debug();
-
-
 
   for(int i = 0; i < 100; i++)
@@ -476,11 +410,5 @@
     tmp->setAbsCoor(((float)rand()/RAND_MAX) * 5000, 50/*+ (float)rand()/RAND_MAX*20*/, ((float)rand()/RAND_MAX -.5) *30);
     this->spawn(tmp);
-
-
   }
-
-
-
-//  ClassList::debug();
 
   this->music = NULL;//(OggPlayer*)ResourceManager::getInstance()->load("sound/00-luke_grey_-_hypermode.ogg", OGG, RP_LEVEL);
@@ -498,60 +426,4 @@
   this->glmis->step();
   // stuff beyond this point remains to be loaded properly
-
-  // initializing the TrackManager
-  TrackManager::getInstance()->addPointV(Vector(150, -35, 5));
-  TrackManager::getInstance()->addPointV(Vector(200,-35, 5));
-  TrackManager::getInstance()->addPointV(Vector(250, -35, 5));
-  TrackManager::getInstance()->addPointV(Vector(320,-33,-.55));
-  TrackManager::getInstance()->setDuration(1);
-  TrackManager::getInstance()->setSavePoint();
-
-  TrackManager::getInstance()->addPointV(Vector(410, 0, 0));
-  TrackManager::getInstance()->addPointV(Vector(510, 20, -10));
-  TrackManager::getInstance()->addPointV(Vector(550, 20, -10));
-  TrackManager::getInstance()->addPointV(Vector(570, 20, -10));
-  TrackManager::getInstance()->setDuration(2);
-
-  TrackManager::getInstance()->forkS("testFork1,testFork2");
-  TrackManager::getInstance()->workOnS("testFork1");
-  TrackManager::getInstance()->addPointV(Vector(640, 25, -30));
-  TrackManager::getInstance()->addPointV(Vector(700, 40, -120));
-  TrackManager::getInstance()->addPointV(Vector(800, 50, -150));
-  TrackManager::getInstance()->addPointV(Vector(900, 60, -100));
-  TrackManager::getInstance()->addPointV(Vector(900, 60, -70));
-  TrackManager::getInstance()->addPointV(Vector(990, 65, -15));
-  TrackManager::getInstance()->addPointV(Vector(1050, 65, -10));
-  TrackManager::getInstance()->addPointV(Vector(1100, 65, -20));
-  TrackManager::getInstance()->setDuration(4);
-
-  TrackManager::getInstance()->workOnS("testFork2");
-  TrackManager::getInstance()->addPointV(Vector(640, 25, 20));
-  TrackManager::getInstance()->addPointV(Vector(670, 50, 120));
-  TrackManager::getInstance()->addPointV(Vector(700, 70, 80));
-  TrackManager::getInstance()->addPointV(Vector(800, 70, 65));
-  TrackManager::getInstance()->addPointV(Vector(850, 65, 65));
-  TrackManager::getInstance()->addPointV(Vector(920, 35, 40));
-  TrackManager::getInstance()->addPointV(Vector(945, 40, 40));
-  TrackManager::getInstance()->addPointV(Vector(970, 24, 40));
-  TrackManager::getInstance()->addPointV(Vector(1000, 40, -7));
-
-  TrackManager::getInstance()->setDuration(4);
-
-
-  TrackManager::getInstance()->joinS("testFork1,testFork2");
-
-  TrackManager::getInstance()->addPointV(Vector(1200, 60, -50));
-  TrackManager::getInstance()->addPointV(Vector(1300, 50, -50));
-  TrackManager::getInstance()->addPointV(Vector(1400, 40, -50));
-  TrackManager::getInstance()->addPointV(Vector(1500, 40, -60));
-  TrackManager::getInstance()->addPointV(Vector(1600, 35, -55));
-  TrackManager::getInstance()->addPointV(Vector(1700, 45, -40));
-  TrackManager::getInstance()->addPointV(Vector(1750, 60, -40));
-  TrackManager::getInstance()->addPointV(Vector(1770, 80, -40));
-  TrackManager::getInstance()->addPointV(Vector(1800, 100, -40));
-  TrackManager::getInstance()->setDuration(10);
-
-  TrackManager::getInstance()->finalize();
-
 
   // LIGHT initialisation
@@ -571,23 +443,6 @@
       {
         LightManager::getInstance()->getLight()->setAbsCoor(-5.0, 10.0, -40.0);
-
-
-        this->localPlayer = new Player ();
-        this->localPlayer->setName ("player");
-        this->spawn (this->localPlayer);
-        this->localPlayer->setRelCoor(Vector(5,0,0));
         /*monitor progress*/
         this->glmis->step();
-
-
-        EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_FIRE1);
-        EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_NEXT_WEAPON);
-        EventHandler::getInstance()->subscribe(this->localPlayer, ES_GAME, KeyMapper::PEV_PREVIOUS_WEAPON);
-
-        /*
-        Field* testField = new Gravity();
-        testField->setMagnitude(10);
-        new PhysicsConnection(this->localPlayer, testField);
-        */
 
         // bind camera
@@ -614,26 +469,4 @@
         this->glmis->step();
 
-        this->pilotNode = new PilotNode();
-        this->spawn(this->pilotNode);
-        this->pilotNode->setAbsCoor(Vector(150, -35, 5));
-        this->pilotNode->addChild(this->localPlayer);
-        this->pilotNode->addChild(this->localCamera);
-        this->localCamera->lookAt(this->localPlayer);
-
-        EventHandler::getInstance()->subscribe(this->pilotNode, ES_GAME, KeyMapper::PEV_UP);
-        EventHandler::getInstance()->subscribe(this->pilotNode, ES_GAME, KeyMapper::PEV_DOWN);
-        EventHandler::getInstance()->subscribe(this->pilotNode, ES_GAME, KeyMapper::PEV_LEFT);
-        EventHandler::getInstance()->subscribe(this->pilotNode, ES_GAME, KeyMapper::PEV_RIGHT);
-        EventHandler::getInstance()->subscribe(this->pilotNode, ES_GAME, EV_MOUSE_MOTION);
-
-        /*
-        PNode* tn = TrackManager::getInstance()->getTrackNode();
-        tn->addChild(this->localPlayer);
-        this->localCamera->lookAt(tn);
-
-        tn->addChild(this->localCamera);
-        this->localPlayer->setParentMode(PNODE_ALL);
-        TrackManager::getInstance()->condition(2, LEFTRIGHT, this->localPlayer);
-        */
         this->glmis->step();
         break;
@@ -663,5 +496,4 @@
 {
   this->bPause = false;
-  this->pilotNode = NULL;
 
   /* update the object position before game start - so there are no wrong coordinates used in the first processing */
@@ -838,8 +670,4 @@
 void World::handleInput ()
 {
-  // localinput
-  //CommandNode* cn = Orxonox::getInstance()->getLocalInput();
-  //cn->process();
-
   EventHandler::getInstance()->process();
 
@@ -893,5 +721,4 @@
 
       /* update tick the rest */
-      TrackManager::getInstance()->tick(this->dtS);
       this->localCamera->tick(this->dtS);
       // tick the engines
Index: branches/powerups/src/story_entities/world.h
===================================================================
--- branches/powerups/src/story_entities/world.h	(revision 5848)
+++ branches/powerups/src/story_entities/world.h	(revision 5955)
@@ -16,5 +16,4 @@
 class Camera;
 class Player;
-class PNode;
 class GLMenuImageScreen;
 class Terrain;
@@ -22,5 +21,4 @@
 class Text;
 class TiXmlElement;
-class PilotNode;
 
 class Shell;
@@ -121,7 +119,4 @@
     tList<WorldEntity>* entities;       //!< A template List of all entities. Every moving thing should be included here, and world automatically updates them.
     Player* localPlayer;                //!< The Player, you fly through the level.
-    PilotNode* pilotNode;               //!< THe pilot node to fly with the mouse
-
-
 };
 
