Index: orxonox/trunk/src/world.cc
===================================================================
--- orxonox/trunk/src/world.cc	(revision 2036)
+++ orxonox/trunk/src/world.cc	(revision 2077)
@@ -28,4 +28,7 @@
 #include "data_tank.h"
 
+#include "list.h"
+#include "world_entity.h"
+
 #include "world.h"
 
@@ -37,16 +40,56 @@
    \brief Create a new World
    
-   This creates a new empty world!
+   This creates a new, empty world!
 */
 World::World () {
-  lastPlayer = null;
-  lastNPC = null;
-  lastEnv = null;
+  //lastPlayer = null;
+  //lastNPC = null;
+  //lastEnv = null;
   primitiveMove = 0;
   step = 0;
+
+  //List<int> *list = new List<int>();
+  npcList = new List<WorldEntity*>();
+  playerList = new List<WorldEntity*>();
+  envList = new List<WorldEntity*>();
 }
 
 
 World::~World () {}
+
+
+
+/** 
+   \brief Load a new World
+   
+   Load a new world. The old world (if any) will be unloaded and becomes unrecoverable. 
+*/
+void World::loadWorld() {}
+
+
+/** 
+   \brief Unloads a new World
+   
+   Unloads a world and frees the memory. You cant game until you have a new world loaded.
+*/
+void World::unloadWorld() {}
+
+
+/** 
+   \brief Pause the game
+   
+   Pauses the game until the pause is released. During this time nothing moves at all and nothing is calculated. Use it if you have to go out of the game to read some mails...
+*/
+void World::pauseWorld() {}
+
+
+/** 
+   \brief Save the game to file
+   \param filename: the filename where the savegame should be saved to
+   
+   Saves the state of the game to a file. The state is catched like in a multiplayer game over a synchronisable interface.
+*/
+void World::saveGameState(char* filename) {}
+
 
 
@@ -59,4 +102,7 @@
 bool World::addPlayer(Player* player) 
 {
+  WorldEntity *we;
+  playerList->add(we);
+  /*
   playerList* listMember = new playerList;
   listMember->player = player;
@@ -72,6 +118,6 @@
     }
   lastPlayer = listMember;
-}
-
+  */
+}
 
 /** 
@@ -79,10 +125,16 @@
    \param player A reference to the new npc object
    
-   Remove a new Player to the game.
+   Remove a new Player to the game. This kills the player objects.
 */
 bool World::removePlayer(Player* player) {
-  cout << "World::removeNPC not implemented yet" << endl;
-}
-
+  playerList->remove(player, LIST_FIND_BW);
+}
+
+/** 
+   \brief Returns the player-entity controlled by the local gamer
+   \return pointer to player object
+   
+   Remove a new Player to the game. This kills the player objects.
+*/
 Player* World::getLocalPlayer() 
 {
@@ -99,4 +151,6 @@
 bool World::addNPC(NPC* npc) 
 {
+  npcList->add(npc, LIST_ADD_NEXT);
+  /*
   npcList* listMember = new npcList;
   listMember->npc = npc;
@@ -112,4 +166,5 @@
     }
   lastNPC = listMember;
+  */
 }
 
@@ -117,10 +172,12 @@
 /** 
    \brief Remove Non-Player Character
-   \param player A reference to the new npc object
-   
-   Remove a new Non-Player-Character to the game.
-*/
-bool World::removeNPC(NPC* npc) {
-
+   \param player A reference to the npc object
+   
+   Remove a Non-Player-Character to the game.
+*/
+bool World::removeNPC(NPC* npc) 
+{
+  npcList->remove(npc, LIST_FIND_FW);
+  /*
   npcList* npcRef = lastNPC;
   npcList* lastRef = lastNPC;
@@ -128,5 +185,6 @@
     {
       if ( npcRef->npc == npc ) {
-	cout << "found" << endl;
+	cout <
+< "found" << endl;
 	if ( npcRef == lastRef ) {
 	  lastNPC = lastNPC->next;
@@ -148,4 +206,5 @@
     }
   cout << "npc left" << endl;
+  */
 }
 
@@ -160,4 +219,5 @@
 bool World::addEnv(Environment* env) 
 {
+  /*
   envList* listMember = new envList;
   listMember->env = env;
@@ -173,4 +233,16 @@
     }
   lastEnv = listMember;
+  */
+}
+
+/** 
+   \brief Remove an environmental object
+   \param player A reference to the env object
+   
+   Remove a environment from the game.
+*/
+bool World::removeEnv(Environment* env) 
+{
+  
 }
 
@@ -189,4 +261,7 @@
   gluLookAt(0.0, -14.0 + DataTank::yOffset, 15.0, 0.0, 0.0 + DataTank::yOffset, 0.0, 0.0, 1.0, 0.0);
   /* first draw all players */
+
+
+  /*
   playerList* tmpPlayer = lastPlayer;
   Player* player = tmpPlayer->player;
@@ -196,5 +271,7 @@
       tmpPlayer = tmpPlayer->next;
     }
+  */
   /* second draw all npcs */
+  /*
   npcList* tmpNPC = lastNPC;
   while( tmpNPC != null )
@@ -203,6 +280,8 @@
       tmpNPC = tmpNPC->next;
     }
+  */
 
   /* now draw the rest of the world: environement */
+  /*
   envList* tmpEnv = lastEnv;
   while( tmpEnv != null )
@@ -211,5 +290,6 @@
       tmpEnv = tmpEnv->next;
     }
-  
+  */
+
   /* draw the ground grid  */
   glColor3f(0.0, 1.0, 0.0); 
@@ -240,4 +320,5 @@
   DataTank::yOffset += step;
 
+  /*
   tmpPlayer = lastPlayer;
   while( tmpPlayer != null ) 
@@ -246,5 +327,5 @@
       tmpPlayer = tmpPlayer->next;
     }
-
+  */
 
 }
@@ -291,10 +372,12 @@
 void World::detectCollision() 
 {
+  /*
   //cout << "World::detectCollision" << endl;
   float xOff, yOff, zOff, radius;
   npcList* tmpNPC, *tmpRef;
-
+  */
   //cout << "World::detectCollsions" << endl;
   /* first: check if any player's shoots trigger a collision */
+  /*
   playerList* tmpPlayer = lastPlayer;
   Player* player = tmpPlayer->player;
@@ -318,4 +401,5 @@
 		  //cout << "COLLISION " << endl;
 		  int state = tmpNPC->npc->hit();
+  */
 		  /* state is a value that marks if the ship dies or not */
 		  /* if state == 0 the ship dies and we have to remove it */
@@ -327,5 +411,5 @@
 		    break;
 		  }
-		  */
+		  
 		}
 	      shoota = shoota->next;
@@ -338,9 +422,11 @@
       tmpPlayer = tmpPlayer->next;
       //cout << "changing play done" << endl;
-    }
-
+      
+    }
+		  */
   //cout << "World::detectCollisions middle" << endl;
 
   /* second: check if any player hits an enemy */
+/*
   tmpPlayer = lastPlayer;
   while( tmpPlayer != null ) 
@@ -365,5 +451,5 @@
   
   
-
+*/
   /* third: check if any enemy shoots a player */
 
@@ -380,6 +466,7 @@
 void World::testThaTest(void) 
 {
+/*
   cout << "World::testThaTest() called" << endl;
-  /* test addPlayer */
+
   cout << "addPlayer test..." << endl;
   playerList* pl = lastPlayer;
@@ -390,5 +477,5 @@
     }
 
-  /* test addNPC */
+
   cout << "addNPC test..." << endl;
   npcList* nl = lastNPC;
@@ -400,5 +487,5 @@
 
 
-  /* test addEnv */
+
   cout << "addEnv test..." << endl;
   envList* en = lastEnv;
@@ -408,5 +495,4 @@
       en = en->next;
     }
-
-  /* test drawWorld() */
-}
+*/
+}
