Index: /orxonox/trunk/src/story_entities/world.cc
===================================================================
--- /orxonox/trunk/src/story_entities/world.cc	(revision 3869)
+++ /orxonox/trunk/src/story_entities/world.cc	(revision 3870)
@@ -367,5 +367,4 @@
 	    trackManager->condition(2, LEFTRIGHT, this->localPlayer);
 	    this->glmis->step();
-
 	    break;
 	  }
Index: /orxonox/trunk/src/world_entities/weapon.cc
===================================================================
--- /orxonox/trunk/src/world_entities/weapon.cc	(revision 3869)
+++ /orxonox/trunk/src/world_entities/weapon.cc	(revision 3870)
@@ -30,32 +30,49 @@
 
 
+/**
+   \brief this initializes the weaponManager for a given nnumber of weapon slots
+   \param number of weapon slots of the model/ship <= 8 (limitied)
+*/
 WeaponManager::WeaponManager(int nrOfSlots) 
 {
   this->nrOfSlots = nrOfSlots;
-  this->nrOfConfigs = 1;
-
-  for(int i = 0; i < W_MAX_CONFS; ++i)
-    this->configs[i] = NULL;
-  this->currentConfig = new weaponConfig;
-  this->configs[0] = this->currentConfig;
-}
+  
+  this->currConfID = W_CONFIG1;
+  this->configs[this->currConfID].bUsed = true;
+}
+
 
 WeaponManager::~WeaponManager() 
 {
-
-}
-
-void WeaponManager::addWeapon(Weapon* weapon, slotID slot, configID config) 
-{
-  if(this->configs[config] == NULL)
-    PRINTF(0)("");
-  //  this->configs[(int)config]->
-}
-
-void WeaponManager::addWeaponConfig(weaponConfig* config) 
-{}
+  /* i dont have to delete the weapons itself, because they are 
+     worldentities and therefore in the entities list of the world
+  */
+}
+
+
+void WeaponManager::addWeapon(Weapon* weapon, int slotID, int configID) 
+{
+  if( slotID == W_FREE_SLOT)
+    {
+      int freeSlot = this->getNextFreeSlot();
+      if( freeSlot < 0 || freeSlot >= this->nrOfSlots)
+	{
+	  PRINTF(0)("There is no free slot in this WeaponConfig to dock this weapon at! Aborting\n");
+	  return;
+	}
+      this->configs[configID].slots[freeSlot] = weapon;
+      return;
+    }
+  this->configs[configID].slots[slotID] = weapon;
+  PRINTF(3)("Added a new Weapon to the WeaponManager: config %i/ slot %i\n", configID, slotID);
+}
+
 
 void WeaponManager::nextWeaponConf() 
-{}
+{
+  for(; this->currConfID < W_MAX_CONFIGS && !this->configs[this->currConfID].bUsed; this->currConfID+=1)
+    printf("");
+}
+
 
 void WeaponManager::prevWeaponConf() 
@@ -63,12 +80,20 @@
 
 
-void WeaponManager::selectConfig(configID config) 
-{
-  if( this->configs[(int)config] != NULL)
-    this->currentConfig = this->configs[(int)config];
-  else
-    PRINTF(0)("There is no weapon config defined with the number W_CONF%i", (int)config);
-}
-
+void WeaponManager::selectConfig(int confID) 
+{
+  PRINTF(0)("There is no weapon config defined with the number W_CONF%i", confID);
+}
+
+
+
+int WeaponManager::getNextFreeSlot()
+{
+  for( int i = 0; i < W_MAX_SLOTS; ++i)
+    {
+      if( this->configs[this->currConfID].slots[i] == NULL)
+	return i;
+    }
+  return -1;
+}
 
 
Index: /orxonox/trunk/src/world_entities/weapon.h
===================================================================
--- /orxonox/trunk/src/world_entities/weapon.h	(revision 3869)
+++ /orxonox/trunk/src/world_entities/weapon.h	(revision 3870)
@@ -34,5 +34,5 @@
 
 #define W_MAX_SLOTS 8
-#define W_MAX_CONFS 4
+#define W_MAX_CONFIGS 4
 
 class Projectile;
@@ -48,22 +48,27 @@
 } weaponSoundType;
 
+
 //! this is an identifier for the slot. there are up to 8 weapon slots -> this means there can't be more than 8 weapons at the same time
-typedef enum slotID {W_SLOT0=0, W_SLOT1, W_SLOT2, W_SLOT3, 
-		     W_SLOT4, W_SLOT5, W_SLOT6, W_SLOT7};
+#define W_SLOT0 0
+#define W_SLOT1 1
+#define W_SLOT2 2
+#define W_SLOT3 3
+#define W_SLOT4 4
+#define W_SLOT5 5
+#define W_SLOT6 6
+#define W_SLOT7 7
+#define W_FREE_SLOT 99
+
 
 //! this is an identifier for the weapon config
-typedef enum configID {W_CONFIG0=0, W_CONFIG1, 
-		       W_CONFIG2, W_CONFIG3};
+#define W_CONFIG0 0
+#define W_CONFIG1 1
+#define W_CONFIG2 2
+#define W_CONFIG3 3
 
 //! this is a weapon Configuration: it has up to 8 slots
 typedef struct weaponConfig {
-  Weapon* slot1;                    //<! standard right side weapon
-  Weapon* slot2;                    //<! standard left side weapon
-  Weapon* slot3;                    //<! custom
-  Weapon* slot4;                    //<! custom
-  Weapon* slot5;                    //<! custom
-  Weapon* slot6;                    //<! custom
-  Weapon* slot7;                    //<! custom
-  Weapon* slot8;                    //<! custom
+  bool bUsed;                       //<! is set to true, if this configuration is 
+  Weapon* slots[8];
 };
 
@@ -74,16 +79,17 @@
   ~WeaponManager();
   
-  void addWeapon(Weapon* weapon, slotID slot, configID config = W_CONFIG0);
-  void addWeaponConfig(weaponConfig* config);
+  void addWeapon(Weapon* weapon, int slotID = W_FREE_SLOT, int configID = W_CONFIG1);
 
   void nextWeaponConf();
   void prevWeaponConf();
-  void selectConfig(configID config);
+  void selectConfig(int configID);
 
  private:
   int nrOfConfigs;                      //<! number of configurations defined
   int nrOfSlots;                        //<! number of weapon slots a ship has
-  weaponConfig* currentConfig;          //<! the currently selected config
-  weaponConfig* configs[4];             //<! a list of four configurations
+  int currConfID;                    //<! the currently selected config
+  weaponConfig configs[4];              //<! a list of four configurations
+  
+  int getNextFreeSlot();
 };
 
