Index: /trunk/src/defs/class_id.h
===================================================================
--- /trunk/src/defs/class_id.h	(revision 7122)
+++ /trunk/src/defs/class_id.h	(revision 7123)
@@ -242,5 +242,5 @@
   CL_COLLISION                  =    0x00000711,
   CL_BV_TREE                    =    0x00701000,
-  CL_BV_TREE_NODE               =    0x00002000,
+  CL_BV_TREE_NODE               =    0x00702000,
   CL_OBB_TREE                   =    0x00000714,
   CL_OBB_TREE_NODE              =    0x00000715,
@@ -270,23 +270,7 @@
 
   CL_PRIMITIVE_MODEL            =    0x00000908,
-  CL_MD2Model                   =    0x00000909,
+  CL_MD2_MODEL                  =    0x00000909,
   CL_HEIGHT_MAP                 =    0x0000090a,
   CL_GRID                       =    0x0000090b,
-
-  // Particles
-  CL_PARTICLE_SYSTEM            =    0x00a01000,
-  CL_SPRITE_PARTICLES           =    0x00002000,
-  CL_SPARK_PARTICLES            =    0x00004000,
-  CL_PNODE_PARTICLES            =    0x00008000,
-  CL_DOT_PARTICLES              =    0x00010000,
-  CL_MODEL_PARTICLES            =    0x00020000,
-
-  CL_PARTICLE_EMITTER           =    0x00a02000,
-  CL_DOT_EMITTER                =    0x00000a21,
-  CL_PLANE_EMITTER              =    0x00000a22,
-  CL_BOX_EMITTER                =    0x00000a23,
-  CL_SPHERE_EMITTER             =    0x00000a24,
-  CL_MODEL_EMITTER              =    0x00000a25,
-
 
   CL_MATERIAL                   =    0x00000810,
@@ -298,12 +282,28 @@
   CL_LIGHTNING_BOLT             =    0x00000851,
 
+    // Particles
+  CL_PARTICLE_SYSTEM            =    0x00a01000,
+  CL_DOT_PARTICLES              =    0x00a02000,
+  CL_SPARK_PARTICLES            =    0x00a04000,
+  CL_SPRITE_PARTICLES           =    0x00a08000,
+  CL_MODEL_PARTICLES            =    0x00a10000,
+  //  CL_PNODE_PARTICLES            =    0x00a20000,
+
+
+  CL_PARTICLE_EMITTER           =    0x00a40000,
+  CL_DOT_EMITTER                =    0x00000a21,
+  CL_PLANE_EMITTER              =    0x00000a22,
+  CL_BOX_EMITTER                =    0x00000a23,
+  CL_SPHERE_EMITTER             =    0x00000a24,
+  //  CL_MODEL_EMITTER              =    0x00000a25,
+
   // Element2D's  (range from 0x00000b00 to 0x00000bff)
   /// GL-GUI
-  CL_GLGUI_WIDGET               =    0x00b00000,
-  CL_GLGUI_BUTTON               =    0x00b01000,
+  CL_GLGUI_WIDGET               =    0x00b01000,
+  CL_GLGUI_BUTTON               =    0x00b02000,
   CL_GLGUI_PUSHBUTTON           =    0x00000b03,
   CL_GLGUI_CHECKBUTTON          =    0x00000b04,
   CL_GLGUI_RADIOBUTTON          =    0x00000b05,
-  CL_GLGUI_CONTAINER            =    0x00b02000,
+  CL_GLGUI_CONTAINER            =    0x00b04000,
   CL_GLGUI_BOX                  =    0x00000b07,
   CL_GLGUI_FRAME                =    0x00000b08,
Index: /trunk/src/lib/graphics/importer/md2Model.cc
===================================================================
--- /trunk/src/lib/graphics/importer/md2Model.cc	(revision 7122)
+++ /trunk/src/lib/graphics/importer/md2Model.cc	(revision 7123)
@@ -77,4 +77,5 @@
 MD2Model::MD2Model(const char* modelFileName, const char* skinFileName, float scale)
 {
+  this->setClassID(CL_MD2_MODEL, "MD2Model");
   /* this creates the data container via ressource manager */
   this->data = (MD2Data*)ResourceManager::getInstance()->load(modelFileName, MD2, RP_GAME, skinFileName, scale);
@@ -222,5 +223,5 @@
   glCullFace(GL_BACK);
 
-  this->data->material->select();
+  this->data->material.select();
 
   /* draw the triangles */
@@ -263,5 +264,5 @@
 //   this->processLighting();
 //   this->interpolate(/*this->verticesList*/);
-  this->data->material->select();
+  this->data->material.select();
 
   /* draw the triangles */
@@ -409,5 +410,4 @@
   delete [] this->pTexCoor;
 
-  delete this->material;
 }
 
@@ -518,7 +518,7 @@
   strcpy(this->skinFileName, fileName);
 
-  this->material = new Material("md2ModelTest");
-  this->material->setDiffuseMap(fileName);
-  this->material->setIllum(3);
-  this->material->setAmbient(1.0, 1.0, 1.0);
-}
+  this->material.setName("md2ModelMaterial");
+  this->material.setDiffuseMap(fileName);
+  this->material.setIllum(3);
+  this->material.setAmbient(1.0, 1.0, 1.0);
+}
Index: /trunk/src/lib/graphics/importer/md2Model.h
===================================================================
--- /trunk/src/lib/graphics/importer/md2Model.h	(revision 7122)
+++ /trunk/src/lib/graphics/importer/md2Model.h	(revision 7123)
@@ -19,8 +19,8 @@
 #define _MD2MODEL_H
 
+#include "base_object.h"
+
 #include "model.h"
-#include "base_object.h"
-#include "stdincl.h"
-
+#include "material.h"
 
 //! These are the needed defines for the max values when loading .MD2 files
@@ -212,5 +212,5 @@
   int*               pLightNormals;         //!< pointer to the light normals
 
-  Material*          material;              //!< pointer to the material
+  Material           material;              //!< pointer to the material
   float              scaleFactor;           //!< the scale factor of the model, (global)
 };
Index: /trunk/src/lib/graphics/importer/model.h
===================================================================
--- /trunk/src/lib/graphics/importer/model.h	(revision 7122)
+++ /trunk/src/lib/graphics/importer/model.h	(revision 7123)
@@ -58,5 +58,4 @@
 
   public:
-    Model();
     virtual ~Model();
 
@@ -85,4 +84,7 @@
     inline unsigned int getTriangleCount() const { return this->pModelInfo.numTriangles; };
 
+  protected:
+    Model();
+
 
   protected:
Index: /trunk/src/lib/lang/base_object.cc
===================================================================
--- /trunk/src/lib/lang/base_object.cc	(revision 7122)
+++ /trunk/src/lib/lang/base_object.cc	(revision 7123)
@@ -140,5 +140,5 @@
   else if (classID & CL_MASK_SUBSUPER_CLASS)
   {
-    if (likely(((this->classID & CL_MASK_SUBSUPER_CLASS_IDA) == (this->classID & CL_MASK_SUBSUPER_CLASS_IDA)) &&
+    if (likely(((this->classID & CL_MASK_SUBSUPER_CLASS_IDA) == (classID & CL_MASK_SUBSUPER_CLASS_IDA)) &&
         this->classID & classID & CL_MASK_SUBSUPER_CLASS_IDB))
       return true;
Index: /trunk/src/lib/lang/class_list.cc
===================================================================
--- /trunk/src/lib/lang/class_list.cc	(revision 7122)
+++ /trunk/src/lib/lang/class_list.cc	(revision 7123)
@@ -276,5 +276,5 @@
     if (object->isA((*cl).classID))
   {
-    PRINT(0)("=%s=-", (*cl).className);
+    PRINT(0)("=%s::0x%.8X=-", (*cl).className, (*cl).classID);
   }
 }
Index: /trunk/src/orxonox.cc
===================================================================
--- /trunk/src/orxonox.cc	(revision 7122)
+++ /trunk/src/orxonox.cc	(revision 7123)
@@ -120,5 +120,5 @@
 
   SDL_QuitSubSystem(SDL_INIT_TIMER);
-  ClassList::debug();
+  ClassList::debug(3);
 
   PRINT(3)
Index: /trunk/src/world_entities/skybox.cc
===================================================================
--- /trunk/src/world_entities/skybox.cc	(revision 7122)
+++ /trunk/src/world_entities/skybox.cc	(revision 7123)
@@ -27,4 +27,6 @@
 #include "network_game_manager.h"
 #include "converter.h"
+#include "resource_manager.h"
+
 
 using namespace std;
@@ -107,6 +109,6 @@
     if( this->material[i])
       delete this->material[i];
-//     if( this->cubeTexture[i])
-//       delete this->cubeTexture[i];
+    if( this->cubeTexture[i])
+      ResourceManager::getInstance()->unload(this->cubeTexture[i]);
   }
 }
@@ -169,7 +171,4 @@
     this->loadCubeMapTextures(top, bottom, left, right, front, back);
 }
-
-
-#include "resource_manager.h"
 
 void SkyBox::loadCubeMapTextures(const char* top, const char* bottom, const char* left,
Index: /trunk/src/world_entities/world_entity.cc
===================================================================
--- /trunk/src/world_entities/world_entity.cc	(revision 7122)
+++ /trunk/src/world_entities/world_entity.cc	(revision 7123)
@@ -190,9 +190,12 @@
   {
     Resource* resource = ResourceManager::getInstance()->locateResourceByPointer(this->models[modelNumber]);
-    //     if (resource != NULL)
-    ResourceManager::getInstance()->unload(resource, RP_LEVEL);
-  }
-  else
-    delete this->models[modelNumber];
+    if (resource != NULL)
+      ResourceManager::getInstance()->unload(resource, RP_LEVEL);
+    else
+    {
+      PRINTF(4)("Forcing model deletion\n");
+      delete this->models[modelNumber];
+    }
+  }
 
   this->models[modelNumber] = model;
