Index: trunk/src/world_entities/world_entity.cc
===================================================================
--- trunk/src/world_entities/world_entity.cc	(revision 10147)
+++ 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
