Index: trunk/src/world_entities/mount_point.cc
===================================================================
--- trunk/src/world_entities/mount_point.cc	(revision 10280)
+++ trunk/src/world_entities/mount_point.cc	(revision 10314)
@@ -10,5 +10,5 @@
 
    ### File Specific
-   main-programmer: Patrick Boenzli patrick@orxonox.net
+   main-programmer: Patrick Boenzli, patrick@orxonox.net
    co-programmer:
 */
@@ -19,4 +19,6 @@
 #include "util/loading/factory.h"
 #include "util/loading/load_param.h"
+#include "util/loading/load_param_xml.h"
+
 
 
@@ -27,5 +29,4 @@
 
 ObjectListDefinition(MountPoint);
-CREATE_FACTORY(MountPoint);
 
 
@@ -33,21 +34,15 @@
  * construct
  */
-MountPoint::MountPoint ()
-{
+MountPoint::MountPoint (const Vector& up, const Vector& forward, const Vector& center, const std::string& name)
+{
+  PRINTF(5)("Created mount point %s\n", name.c_str());
+
+  this->_name = name;
+  this->setAbsCoor( center);
+  this->setAbsDir( Quaternion(forward, up));
+
   this->init();
 }
 
-
-/**
- * constructor
- * @param root the xml root element
- */
-MountPoint::MountPoint(const TiXmlElement* root)
-{
-  this->init();
-
-  if( root != NULL)
-    this->loadParams(root);
-}
 
 
@@ -75,7 +70,114 @@
  * @param root the XML-element to load the MD2Creature's properties from
  */
-void MountPoint::loadParams(const TiXmlElement* root)
-{
-  WorldEntity::loadParams(root);
+void MountPoint::initMountPoint(const TiXmlElement* root)
+{
+  if( root == NULL)
+  {
+    PRINTF(1)("MountPoint - initialization failed, since I got no valid xml element\n");
+    return;
+  }
+  // now get the first element
+  const TiXmlElement* element = root->FirstChildElement("MountPoints");
+  if( element == NULL)
+  {
+    PRINTF(1)("I am in section: %s, Object Information file is missing a proper 'MountPoints' section\n", root->Value());
+//     element = root->FirstChildElement( );
+//     PRINTF(0)("first child: %s\n", element->Value());
+  }
+  else
+  {
+    element = element->FirstChildElement();
+    // parse the information for this mount point
+
+    PRINTF(4)("Loading WorldEntities\n");
+    while( element != NULL)
+    {
+      std::string name = element->Value();
+
+      PRINTF(5)("checking %s against local %s\n", name.c_str(), this->_name.c_str());
+      // check if we got the right mount point
+      if( this->_name.find(name, 0) != std::string::npos)
+      {
+        PRINTF(5)("found mount point %s\n", this->_name.c_str());
+        // load it
+        this->loadParam(element);
+      }
+
+      element = element->NextSiblingElement();
+    }
+  }
+}
+
+
+
+/**
+ * load the parameters from the xml section
+ * @param root the root element of this xml branche
+ */
+void MountPoint::loadParam(const TiXmlElement* root)
+{
+  // first check for the description
+  LoadParam(root, "Description", this, MountPoint, setDescription)
+  .describe("Sets this mount point a description");
+
+  // now check for the orx class to create
+  LoadParam(root, "OrxClass", this, MountPoint, setOrxClass)
+  .describe("Sets the class this mount points should host");
+
+  LoadParamXML(root, "Details", this, MountPoint, loadDetails);
+}
+
+
+/**
+ * load the parameters from the world entity
+ * @param root the root element of this xml branche
+ */
+void MountPoint::loadDetails(const TiXmlElement* root)
+{
+  if( this->_mount != NULL)
+  {
+    PRINTF(0)("Got detail informations\n");
+    this->_mount->loadParams( root);
+  }
+}
+
+
+/**
+ * setst the description (optional) via xml tag
+ * @param description string containing the description
+ */
+void MountPoint::setDescription(const std::string& description)
+{
+  this->_description = description;
+}
+
+
+
+/**
+ * sets the class of this mount point
+ * @param orxClass class
+ */
+void MountPoint::setOrxClass(const std::string& orxClass)
+{
+  // create the object for this mount point
+  BaseObject* obj = Factory::fabricate(orxClass);
+  // check if the object is created correctly
+  if( obj != NULL)
+  {
+    if( obj->isA( WorldEntity::staticClassID()))
+    {
+      // cast down the object to WE
+      this->_mount = dynamic_cast<WorldEntity*>(obj);
+
+      // now set the position, direction and reparent it to this node
+      this->_mount->setAbsCoor( this->getAbsCoor());
+      this->_mount->setAbsDir( this->getAbsDir());
+      this->_mount->setParent( this);
+
+      this->_mount->toList( (OM_LIST)(this->getOMListNumber()+1));
+    }
+  }
+  else
+    PRINTF(1)("Couldn't create %s for this mount point (%s)\n", orxClass.c_str(), this->_name.c_str());
 }
 
@@ -89,5 +191,4 @@
 {
 
-
 }
 
@@ -98,5 +199,4 @@
 void MountPoint::draw() const
 {
-
 }
 
@@ -108,5 +208,6 @@
 void MountPoint::debugDraw() const
 {
-
+  // invoke the underlying pnode debug draw
+  this->debugDraw();
 }
 
Index: trunk/src/world_entities/mount_point.h
===================================================================
--- trunk/src/world_entities/mount_point.h	(revision 10280)
+++ trunk/src/world_entities/mount_point.h	(revision 10314)
@@ -12,11 +12,14 @@
 
   public:
-    MountPoint ();
-    MountPoint(const TiXmlElement* root);
+    MountPoint (const Vector& up, const Vector& forward, const Vector& center, const std::string& name);
     virtual ~MountPoint ();
 
     void init();
-    virtual void loadParams(const TiXmlElement* root);
+    void initMountPoint(const TiXmlElement* root);
+    void loadParam(const TiXmlElement* root);
+    void loadDetails(const TiXmlElement* root);
 
+    void setDescription(const std::string& description);
+    void setOrxClass(const std::string& orxClass);
 
     virtual void tick (float time);
@@ -32,4 +35,7 @@
   private:
     WorldEntity*         _mount;       //!< the entity mounted at this mount point
+    std::string          _name;        //!< the name of the mount point
+
+    std::string          _description; //!< string containing an optional description
 
 };
Index: trunk/src/world_entities/world_entity.cc
===================================================================
--- trunk/src/world_entities/world_entity.cc	(revision 10280)
+++ trunk/src/world_entities/world_entity.cc	(revision 10314)
@@ -12,6 +12,7 @@
 
    ### File Specific:
-   main-programmer: Patrick Boenzli, Benjamin Grauer
-   co-programmer: Christian Meier
+   main-programmer: Patrick Boenzli
+   main-programmer: Benjamin Grauer
+   co-programmer:   Christian Meier
 */
 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
@@ -73,4 +74,6 @@
   this->scaling = 1.0f;
   this->oiFile = NULL;
+  // add 10 members to this array
+  this->mountPoints.reserve(10);
 
   /* OSOLETE */
@@ -141,4 +144,7 @@
   .describe("the fileName of the model, that should be loaded onto this world-entity. (must be relative to the data-dir)")
   .defaultValues("", 1.0f, 0);
+
+  LoadParam(root, "mountpoints", this, WorldEntity, loadMountPoints)
+  .describe("the fileName of the object information file (optional)");
 
   LoadParam(root, "maxHealth", this, WorldEntity, setHealthMax)
@@ -204,16 +210,17 @@
       StaticModel* model = new StaticModel();
       *model = ResourceOBJ(fileName, this->scaling);
+
+      // check if ther is a valid model and load other stuff
       if (model->getVertexCount() > 0)
       {
         this->setModel(model, modelNumber);
-	if( modelNumber == 0 /* FIXME && !this->isA(CL_WEAPON) */)
+
+	if( modelNumber == 0)
+        {
 	  this->buildObbTree(obbTreeDepth);
+        }
       }
       else
         delete model;
-
-      // now get the object information file for this model, if any
-      std::string oifName = fileName.substr(0, fileName.length() - 4) + ".oif";
-      this->loadObjectInformationFile( oifName);
     }
     /// LOADING AN MD2-model
@@ -269,9 +276,39 @@
  * @param fileName the name of the file
  */
-void WorldEntity::loadObjectInformationFile(const std::string& fileName)
-{
-  PRINTF(4)("loading the oif File: %s\n", fileName.c_str());
-
+void WorldEntity::loadMountPoints(const std::string& fileName)
+{
+  PRINTF(5)("loading the oif File: %s\n", fileName.c_str());
+
+  // now load the object information file
   this->oiFile = new ObjectInformationFile(fileName);
+
+  // get the model to load
+  Model* model = this->getModel();
+
+  // extract the mount points
+  model->extractMountPoints();
+
+  // first get all mount points from the model
+  const std::list<mountPointSkeleton> mpList = model->getMountPoints();
+  // for each skeleton create a mounting point world entity
+  std::list<mountPointSkeleton>::const_iterator it = mpList.begin();
+
+  for( ; it != mpList.end(); it++)
+  {
+    // create the mount points world entity
+    MountPoint* mp = new MountPoint( (*it).up, (*it).forward, (*it).center, (*it).name);
+    // parent it to this WE
+    mp->setParent( this);
+    // now add to the right group
+    mp->toList( (OM_LIST)(this->getOMListNumber()+1));
+    // now get the number and add the mount point to the slot
+    std::string nrStr = (*it).name.substr(3, 2);
+    // add the mount point
+    this->addMountPoint(atoi(nrStr.c_str()), mp);
+
+    // now fill the mount point
+    mp->initMountPoint( this->oiFile->getMountPointDescription());
+  }
+
 }
 
@@ -337,7 +374,12 @@
 void WorldEntity::addMountPoint(int slot, MountPoint* mountPoint)
 {
-  if( this->mountPoints[slot] != NULL)
-  {
-    PRINTF(0)("adding a mount point to a slot, that already exists! ignoring - maybe some object do not get connected well (object: %s)\n", this->getClassCName());
+  if( this->mountPoints.capacity() < (unsigned int)slot)
+  {
+    // reserve 5 more slots than needed so this function is called as rare as possible
+    this->mountPoints.reserve(slot + 5);
+  }
+  else if( this->mountPoints[slot] != NULL)
+  {
+    PRINTF(4)("adding a mount point to a slot, that already is occupied! ignoring - maybe some object did not get connected well (object: %s)\n", this->getClassCName());
   }
 
@@ -794,4 +836,22 @@
 
 
+
+/**
+ * draw the mounting points
+ */
+void WorldEntity::debugDrawMountPoints() const
+{
+
+  std::vector<MountPoint*>::const_iterator it = this->mountPoints.begin();
+  for( ; it < this->mountPoints.end(); it++)
+  {
+    if( (*it) != NULL)
+    {
+      (*it)->debugDraw();
+    }
+  }
+}
+
+
 /**
  * Debug the WorldEntity
Index: trunk/src/world_entities/world_entity.h
===================================================================
--- trunk/src/world_entities/world_entity.h	(revision 10280)
+++ trunk/src/world_entities/world_entity.h	(revision 10314)
@@ -53,5 +53,5 @@
   Model* getModel(unsigned int modelNumber = 0) const { return (this->models.size() > modelNumber)? this->models[modelNumber] : NULL; };
 
-  void loadObjectInformationFile(const std::string& fileName);
+  void loadMountPoints(const std::string& fileName);
   inline void loadMD2Texture(const std::string& fileName) { this->md2TextureFileName = fileName; }
 
@@ -73,4 +73,5 @@
   virtual void tick (float time);
   virtual void draw () const;
+  void debugDrawMountPoints() const;
 
   /* --- Collision Detection Block  --- */
