Index: trunk/src/world_entities/weapons/weapon_manager.cc
===================================================================
--- trunk/src/world_entities/weapons/weapon_manager.cc	(revision 10419)
+++ trunk/src/world_entities/weapons/weapon_manager.cc	(revision 10437)
@@ -15,4 +15,5 @@
 
    2005-07-24: Benjamin Grauer: restructurate, so it can handle the new Weapons.
+   2007-01-28: Patrick Boenzli: loadable slots
 */
 
@@ -21,4 +22,5 @@
 #include "weapon_manager.h"
 #include "weapon.h"
+#include "weapon_slot.h"
 #include "crosshair.h"
 
@@ -77,7 +79,8 @@
   for (int i = 0; i < WM_MAX_SLOTS; i++)
   {
-    this->currentSlotConfig[i].capability = WTYPE_ALL;
-    this->currentSlotConfig[i].currentWeapon = NULL;
-    this->currentSlotConfig[i].nextWeapon = NULL;
+    this->currentSlotConfig[i] = new WeaponSlot();
+    this->currentSlotConfig[i]->setCapability(WTYPE_ALL);
+    this->currentSlotConfig[i]->setCurrentWeapon(NULL);
+    this->currentSlotConfig[i]->setNextWeapon(NULL);
 
     // NAMING
@@ -93,6 +96,6 @@
       sprintf(tmpName, "WeaponMan_slot%d", i);
     }
-    this->currentSlotConfig[i].position.setName(tmpName);
-    this->currentSlotConfig[i].position.deactivateNode();
+    this->currentSlotConfig[i]->setName(tmpName);
+    this->currentSlotConfig[i]->deactivateNode();
     delete[] tmpName;
   }
@@ -199,5 +202,5 @@
   {
     for (int i = 0; i < WM_MAX_SLOTS; i++)
-      this->parentNode->addChild(&this->currentSlotConfig[i].position);
+      this->parentNode->addChild(this->currentSlotConfig[i]);
   }
 
@@ -227,8 +230,8 @@
   if (slot < this->slotCount)
   {
-    this->currentSlotConfig[slot].position.setRelCoor(position);
+    this->currentSlotConfig[slot]->setRelCoor(position);
 
     if (parent != NULL)
-      this->currentSlotConfig[slot].position.setParent(parent);
+      this->currentSlotConfig[slot]->setParent(parent);
   }
 }
@@ -243,5 +246,5 @@
 {
   if (slot < this->slotCount)
-    this->currentSlotConfig[slot].position.setRelDir(rotation);
+    this->currentSlotConfig[slot]->setRelDir(rotation);
 }
 
@@ -298,9 +301,9 @@
   }
 
-  if (!(this->currentSlotConfig[slotID].capability & weapon->getCapability() & WTYPE_ALLKINDS) &&
-      this->currentSlotConfig[slotID].capability & weapon->getCapability() & WTYPE_ALLDIRS)
+  if (!(this->currentSlotConfig[slotID]->getCapability() & weapon->getCapability() & WTYPE_ALLKINDS) &&
+      this->currentSlotConfig[slotID]->getCapability() & weapon->getCapability() & WTYPE_ALLDIRS)
   {
     PRINTF(2)("Unable to add Weapon with wrong capatibility to Slot %d (W:%d M:%d)\n",
-              slotID, weapon->getCapability(), this->currentSlotConfig[slotID].capability);
+              slotID, weapon->getCapability(), this->currentSlotConfig[slotID]->getCapability());
     return false;
   }
@@ -313,5 +316,5 @@
   weapon->setAmmoContainer(this->getAmmoContainer(weapon->getProjectileType()));
   if(configID == this->currentConfigID)
-    this->currentSlotConfig[slotID].nextWeapon = weapon;
+    this->currentSlotConfig[slotID]->nextWeapon = weapon;
   //if (this->parent != NULL)
   {
@@ -319,5 +322,5 @@
     if (this->parentEntity->isA(Playable::staticClassID()))
       dynamic_cast<Playable*>(this->parentEntity)->weaponConfigChanged();
-    
+
     weapon->setDefaultTarget(this->crosshair);
   }
@@ -352,5 +355,5 @@
  * sets the capabilities of a Slot
  * @param slot the slot to set the capability
- * @param slotCapability the capability @see WM_SlotCapability
+ * @param slotCapability the capability @see WeaponSlotCapability
  */
 void WeaponManager::setSlotCapability(int slot, long slotCapability)
@@ -358,5 +361,5 @@
   if (slot > slotCount)
     return;
-  this->currentSlotConfig[slot].capability = slotCapability;
+  this->currentSlotConfig[slot]->setCapability(slotCapability);
 }
 
@@ -381,7 +384,7 @@
           this->configs[i][j] = NULL;
       }
-      if (this->currentSlotConfig[j].currentWeapon == weapon)
+      if (this->currentSlotConfig[j]->getCurrentWeapon() == weapon)
       {
-        this->currentSlotConfig[j].nextWeapon = NULL;
+        this->currentSlotConfig[j]->setNextWeapon(NULL);
       }
     }
@@ -422,5 +425,5 @@
 
   for (int i = 0; i < WM_MAX_SLOTS; i++)
-    this->currentSlotConfig[i].nextWeapon = this->configs[currentConfigID][i];
+    this->currentSlotConfig[i]->nextWeapon = this->configs[currentConfigID][i];
 }
 
@@ -436,5 +439,5 @@
   {
 //     printf("%i ", i);
-	  firingWeapon = this->currentSlotConfig[i].currentWeapon;
+	  firingWeapon = this->currentSlotConfig[i]->getCurrentWeapon();
       if( firingWeapon != NULL && firingWeapon->getCurrentState() == WS_SHOOTING) continue;
 	  if( firingWeapon != NULL) firingWeapon->requestAction(WA_SHOOT);
@@ -455,5 +458,5 @@
   for(int i = 0; i < this->slotCount; i++)
   {
-    firingWeapon = this->currentSlotConfig[i].currentWeapon;
+    firingWeapon = this->currentSlotConfig[i]->currentWeapon;
     if( firingWeapon != NULL) firingWeapon->requestAction(WA_NONE);
   }
@@ -478,11 +481,11 @@
 
     //NICE LITTLE DEBUG FUNCTION
-    /*   if (this->currentSlotConfig[i].currentWeapon != NULL || this->currentSlotConfig[i].nextWeapon != NULL)
-      printf("%p %p\n", this->currentSlotConfig[i].currentWeapon, this->currentSlotConfig[i].nextWeapon);*/
+    /*   if (this->currentSlotConfig[i]->currentWeapon != NULL || this->currentSlotConfig[i]->nextWeapon != NULL)
+      printf("%p %p\n", this->currentSlotConfig[i]->currentWeapon, this->currentSlotConfig[i]->nextWeapon);*/
 
     // current Weapon in Slot i
-    tickWeapon = this->currentSlotConfig[i].currentWeapon;
+    tickWeapon = this->currentSlotConfig[i]->currentWeapon;
     // On A change (current != next)
-    if (tickWeapon != this->currentSlotConfig[i].nextWeapon)
+    if (tickWeapon != this->currentSlotConfig[i]->nextWeapon)
     {
       // if a Weapon is Active in slot i, deactivate it.
@@ -497,10 +500,10 @@
         {
           tickWeapon->toList(OM_NULL);
-          this->currentSlotConfig[i].currentWeapon = NULL;
+          this->currentSlotConfig[i]->currentWeapon = NULL;
         }
       }
       // switching to next Weapon
-      tickWeapon = this->currentSlotConfig[i].currentWeapon = this->currentSlotConfig[i].nextWeapon;
-      
+      tickWeapon = this->currentSlotConfig[i]->currentWeapon = this->currentSlotConfig[i]->nextWeapon;
+
       if (tickWeapon != NULL)
       {
@@ -508,14 +511,14 @@
         tickWeapon->toList(this->parentEntity->getOMListNumber());
         tickWeapon->requestAction(WA_ACTIVATE);
-        this->currentSlotConfig[i].position.activateNode();
-        tickWeapon->setParent(&this->currentSlotConfig[i].position);
+        this->currentSlotConfig[i]->activateNode();
+        tickWeapon->setParent(this->currentSlotConfig[i]);
       }
       else
-        this->currentSlotConfig[i].position.deactivateNode();
+        this->currentSlotConfig[i]->deactivateNode();
       if (this->parentEntity != NULL && this->parentEntity->isA(Playable::staticClassID()))
         dynamic_cast<Playable*>(this->parentEntity)->weaponConfigChanged();
     }
     else if (unlikely(tickWeapon != NULL && tickWeapon->getCurrentState() == WS_DEACTIVATING))
-      this->currentSlotConfig[i].nextWeapon = NULL;
+      this->currentSlotConfig[i]->nextWeapon = NULL;
   }
 }
@@ -531,5 +534,5 @@
   for (int i = 0; i < this->slotCount; i++)
   {
-    drawWeapon = this->currentSlotConfig[i].currentWeapon;
+    drawWeapon = this->currentSlotConfig[i]->currentWeapon;
     if( drawWeapon != NULL && drawWeapon->isVisible())
       drawWeapon->draw();
@@ -550,6 +553,6 @@
       {
         if( this->configs[configID][i] == NULL &&
-            (this->currentSlotConfig[i].capability & capability & WTYPE_ALLKINDS) &&
-            (this->currentSlotConfig[i].capability & capability & WTYPE_ALLDIRS))
+            (this->currentSlotConfig[i]->getCapability() & capability & WTYPE_ALLKINDS) &&
+            (this->currentSlotConfig[i]->getCapability() & capability & WTYPE_ALLDIRS))
           return i;
       }
@@ -560,6 +563,6 @@
     {
       if( this->configs[configID][i] == NULL &&
-          (this->currentSlotConfig[i].capability & capability & WTYPE_ALLKINDS) &&
-          (this->currentSlotConfig[i].capability & capability & WTYPE_ALLDIRS))
+          (this->currentSlotConfig[i]->getCapability() & capability & WTYPE_ALLKINDS) &&
+          (this->currentSlotConfig[i]->getCapability() & capability & WTYPE_ALLDIRS))
         return i;
     }
@@ -604,2 +607,20 @@
   }
 }
+
+
+long WeaponManager::getSlotCapability(int slot) const
+{
+  return this->currentSlotConfig[slot]->getCapability();
+}
+
+const Vector& WeaponManager::getSlotPosition(int slot) const
+{
+  return this->currentSlotConfig[slot]->getRelCoor();
+}
+
+Weapon* WeaponManager::getWeapon(int slotID) const
+{
+  return (slotID >= 0 && slotID < this->slotCount)? this->currentSlotConfig[slotID]->getNextWeapon(): NULL;
+}
+
+
Index: trunk/src/world_entities/weapons/weapon_manager.h
===================================================================
--- trunk/src/world_entities/weapons/weapon_manager.h	(revision 10419)
+++ trunk/src/world_entities/weapons/weapon_manager.h	(revision 10437)
@@ -21,6 +21,8 @@
 #include "ammo_container.h"
 
+
 // FORWARD DECLARATION
 template <class T> class tAnimation;
+class WeaponSlot;
 
 #define    WM_MAX_SLOTS            10             //!< How many slots the WeaponManager has at its max
@@ -40,14 +42,4 @@
 class WeaponManager : public BaseObject {
   ObjectListDeclaration(WeaponManager);
-
-  //! an enumerator defining a Slot, where a Weapon can be stored inside.
-  typedef struct
-  {
-    PNode         position;               //!< the relative Position to the position of the carrying entity. (const PNode* parent; of WeaponManager)
-    long          capability;             //!< the capabilities of the Slot @see WM_SlotCapability.
-
-    Weapon*       currentWeapon;          //!< The current weapon this slot is carrying.
-    Weapon*       nextWeapon;             //!< either NULL or the next weapon that will be set (require currentWeapon to deactivate)
-  } WM_Slot;
 
   public:
@@ -70,8 +62,8 @@
     void setSlotDirection(int slot, const Quaternion& rotation);
     /** @param slot the slot to get the relative position from @returns the relative position of the Carrier to the Slot */
-    const Vector& getSlotPosition(int slot) const { return this->currentSlotConfig[slot].position.getRelCoor(); };
+    const Vector& getSlotPosition(int slot) const;
     void setSlotCapability(int slot, long slotCapability);
     /** @param slot the slot to get the capabilities from @returns the capabilies */
-    long getSlotCapability(int slot) const { return this->currentSlotConfig[slot].capability; };
+    long getSlotCapability(int slot) const;
 
     void setParentEntity(WorldEntity* parent);
@@ -85,5 +77,5 @@
     void removeWeapon(Weapon* weapon, int configID = -1);
 
-    Weapon* getWeapon(int slotID) const { return (slotID >= 0 && slotID < this->slotCount)? this->currentSlotConfig[slotID].nextWeapon: NULL; };
+    Weapon* getWeapon(int slotID) const;
 
     // FIXME ::
@@ -122,5 +114,5 @@
     int                     currentConfigID;                          //!< the currently selected config.
     Weapon*                 configs[WM_MAX_CONFIGS][WM_MAX_SLOTS];    //!< An array of predefined configurations and assigned weapon.
-    WM_Slot                 currentSlotConfig[WM_MAX_SLOTS];          //!< The currentConfigureation.
+    WeaponSlot*             currentSlotConfig[WM_MAX_SLOTS];          //!< The currentConfigureation.
 
     Weapon*                 availiableWeapons[WM_MAX_LOADED_WEAPONS]; //!< The availiable Weapons of this WeaponManager
Index: trunk/src/world_entities/weapons/weapon_slot.cc
===================================================================
--- trunk/src/world_entities/weapons/weapon_slot.cc	(revision 10437)
+++ trunk/src/world_entities/weapons/weapon_slot.cc	(revision 10437)
@@ -0,0 +1,40 @@
+
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+### File Specific
+   main-programmer: Patrick Boenzli
+
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON
+
+#include "weapon_slot.h"
+#include "util/loading/factory.h"
+
+
+ObjectListDefinition(WeaponSlot);
+
+
+WeaponSlot::WeaponSlot()
+{
+  this->registerObject(this, WeaponSlot::_objectList);
+
+}
+
+WeaponSlot::WeaponSlot(const TiXmlElement* root)
+{
+   this->registerObject(this, WeaponSlot::_objectList);
+
+}
+
+
+WeaponSlot::~WeaponSlot()
+{}
Index: trunk/src/world_entities/weapons/weapon_slot.h
===================================================================
--- trunk/src/world_entities/weapons/weapon_slot.h	(revision 10437)
+++ trunk/src/world_entities/weapons/weapon_slot.h	(revision 10437)
@@ -0,0 +1,44 @@
+/*!
+ * @file weapon_slot.h
+ */
+
+
+#ifndef _WEAPON_SLOT_H
+#define _WEAPON_SLOT_H
+
+#include "p_node.h"
+
+
+class Weapon;
+
+//! a class defining a Slot, where a Weapon can be stored inside.
+class WeaponSlot : public PNode
+{
+  ObjectListDeclaration(WeaponSlot);
+
+public:
+
+  WeaponSlot();
+  WeaponSlot(const TiXmlElement* root);
+  virtual ~WeaponSlot();
+
+
+  long getCapability() { return this->capability; }
+  void setCapability(long cap) { this->capability = cap; }
+
+  inline Weapon* getCurrentWeapon() { return this->currentWeapon; }
+  inline void setCurrentWeapon(Weapon* weapon) { this->currentWeapon = weapon; }
+
+  inline Weapon* getNextWeapon() { return this->nextWeapon; }
+  inline void setNextWeapon(Weapon* weapon) { this->nextWeapon = weapon; }
+
+//   private:
+
+  long          capability;             //!< the capabilities of the Slot @see WeaponSlotCapability.
+
+  Weapon*       currentWeapon;          //!< The current weapon this slot is carrying.
+  Weapon*       nextWeapon;             //!< either NULL or the next weapon that will be set (require currentWeapon to deactivate)
+};
+
+
+#endif /* _WEAPON_SLOT_H */
