Index: trunk/src/world_entities/npcs/attractor_mine.cc
===================================================================
--- trunk/src/world_entities/npcs/attractor_mine.cc	(revision 9656)
+++ trunk/src/world_entities/npcs/attractor_mine.cc	(revision 9869)
@@ -33,13 +33,15 @@
 #include "effects/explosion.h"
 
-CREATE_FACTORY(AttractorMine, CL_ATTRACTOR_MINE);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(AttractorMine, CL_ATTRACTOR_MINE);
+CREATE_FACTORY(AttractorMine);
 #include "script_class.h"
-CREATE_SCRIPTABLE_CLASS(AttractorMine, CL_ATTRACTOR_MINE,
-                        addMethod("setName", ExecutorLua1<BaseObject,const std::string&>(&BaseObject::setName))
-                       //Coordinates
-                        ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
-                        ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
-                        ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
-                        ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
+CREATE_SCRIPTABLE_CLASS(AttractorMine,
+                        addMethod("setName", Executor1<BaseObject, lua_State*,const std::string&>(&BaseObject::setName))
+                        //Coordinates
+                        ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
+                        ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
+                        ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
+                        ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
                        );
 
@@ -50,5 +52,5 @@
     : NPC(NULL)
 {
-  this->setClassID(CL_ATTRACTOR_MINE, "AttractorMine");
+  this->registerObject(this, AttractorMine::_objectList);
 
   this->toList(OM_GROUP_02);
@@ -64,6 +66,6 @@
 
   this->shader = NULL;
-  if (likely(Shader::checkShaderAbility()))
-    this->shader = Shader::getShader("shaders/toon.vert", "shaders/toon.frag");
+  //if (likely(Shader::checkShaderAbility()))
+//    this->shader = Shader::getShader("shaders/toon.vert", "shaders/toon.frag");
 
   this->randomRotAxis = VECTOR_RAND(1);
@@ -76,8 +78,5 @@
 AttractorMine::~AttractorMine ()
 {
-  if (this->shader)
-    Shader::unload(this->shader);
 }
-
 
 void AttractorMine::loadParams(const TiXmlElement* root)
Index: trunk/src/world_entities/npcs/attractor_mine.h
===================================================================
--- trunk/src/world_entities/npcs/attractor_mine.h	(revision 9656)
+++ trunk/src/world_entities/npcs/attractor_mine.h	(revision 9869)
@@ -9,4 +9,5 @@
 
 class AttractorMine : public NPC {
+  ObjectListDeclaration(AttractorMine);
 
  public:
Index: trunk/src/world_entities/npcs/door.cc
===================================================================
--- trunk/src/world_entities/npcs/door.cc	(revision 9656)
+++ trunk/src/world_entities/npcs/door.cc	(revision 9869)
@@ -25,11 +25,8 @@
 
 #include "door.h"
-#include "class_list.h"
 
-
-
-
-
-CREATE_FACTORY(Door, CL_DOOR);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(Door, CL_DOOR);
+CREATE_FACTORY(Door);
 
 
@@ -47,6 +44,5 @@
 Door::Door(const TiXmlElement* root)
 {
-
-  this->setClassID(CL_DOOR, "Door");
+  this->registerObject(this, Door::_objectList);
   this->scale = 1.0f;
   this->actionRadius = 1.0;
@@ -152,5 +148,6 @@
 
 
-
+#include "playable.h"
+#include "generic_npc.h"
 /**
  * checks if the door is open
@@ -159,16 +156,13 @@
 {
 
-  std::list<BaseObject*>::const_iterator it;
-  const std::list<BaseObject*>* list = ClassList::getList(CL_PLAYABLE);
   WorldEntity* entity;
   float distance;
 
-  if( list == NULL)
-    return false;
-
+  for (ObjectList<Playable>::const_iterator it = Playable::objectList().begin();
+       it != Playable::objectList().end();
+       ++it)
   // for all players
-  for( it = list->begin(); it != list->end(); it++)
   {
-    entity = dynamic_cast<WorldEntity*>(*it);
+    entity = (*it);
 
     distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len());
@@ -178,10 +172,10 @@
 
 
-  list = ClassList::getList(CL_GENERIC_NPC);
-  if( list == NULL)
-    return false;
-  for( it = list->begin(); it != list->end(); it++)
+
+  for (ObjectList<GenericNPC>::const_iterator it = GenericNPC::objectList().begin();
+       it != GenericNPC::objectList().end();
+       ++it)
   {
-    entity = dynamic_cast<WorldEntity*>(*it);
+    entity = (*it);
 
     distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len());
Index: trunk/src/world_entities/npcs/door.h
===================================================================
--- trunk/src/world_entities/npcs/door.h	(revision 9656)
+++ trunk/src/world_entities/npcs/door.h	(revision 9869)
@@ -21,4 +21,6 @@
 class Door : public WorldEntity
 {
+  ObjectListDeclaration(Door);
+
   public:
     Door(const TiXmlElement* root = NULL);
Index: trunk/src/world_entities/npcs/gate.cc
===================================================================
--- trunk/src/world_entities/npcs/gate.cc	(revision 9656)
+++ trunk/src/world_entities/npcs/gate.cc	(revision 9869)
@@ -25,6 +25,4 @@
 
 #include "gate.h"
-#include "class_list.h"
-
 #include "effects/explosion.h"
 
@@ -33,18 +31,20 @@
 
 
-
-CREATE_FACTORY(Gate, CL_GATE);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(Gate, CL_GATE);
+CREATE_FACTORY(Gate);
 
 
 #include "script_class.h"
-CREATE_SCRIPTABLE_CLASS(Gate, CL_GATE,
-                            addMethod("hide", ExecutorLua0<WorldEntity>(&WorldEntity::hide))
-                            ->addMethod("unhide", ExecutorLua0<WorldEntity>(&WorldEntity::unhide))
-                            ->addMethod("destroy", ExecutorLua0<Gate>(&Gate::destroy))    
-                            ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
-                            ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
-                            ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
-                            ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
+CREATE_SCRIPTABLE_CLASS(Gate,
+			addMethod("hide", Executor0<WorldEntity, lua_State*>(&WorldEntity::hide))
+			    ->addMethod("unhide", Executor0<WorldEntity, lua_State*>(&WorldEntity::unhide))
+			    ->addMethod("destroy", Executor0<Gate, lua_State*>(&Gate::destroy))
+			    ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
+			    ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
+			    ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
+			    ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
                        );
+
 
 
@@ -62,6 +62,5 @@
 Gate::Gate(const TiXmlElement* root)
 {
-
-  this->setClassID(CL_GATE, "Gate");
+  this->registerObject(this, Gate::_objectList);
   this->scale = 1.0f;
   this->actionRadius = 1.0;
@@ -165,8 +164,8 @@
 void Gate::close()
 {
-  
+
   if( this->destroyed)
     return;
-  
+
   this->setAnimation(GATE_CLOSE, MD2_ANIM_ONCE);
   this->bOpen = false;
@@ -178,13 +177,15 @@
   if( this->destroyed)
     return;
-  
+
   this->setAnimation(GATE_DIE, MD2_ANIM_ONCE);
 
   Explosion::explode(this, Vector(this->getScaling()/160,this->getScaling()/160,this->getScaling()/160));
-  
-  
+
+
   this->destroyed = true;
 }
 
+#include "playable.h"
+#include "generic_npc.h"
 
 /**
@@ -195,15 +196,13 @@
 
   std::list<BaseObject*>::const_iterator it;
-  const std::list<BaseObject*>* list = ClassList::getList(CL_PLAYABLE);
   WorldEntity* entity;
   float distance;
 
-  if( list == NULL)
-    return false;
-
   // for all players
-  for( it = list->begin(); it != list->end(); it++)
-  {
-    entity = dynamic_cast<WorldEntity*>(*it);
+  for (ObjectList<Playable>::const_iterator it = Playable::objectList().begin();
+       it != Playable::objectList().end();
+       ++it)
+  {
+    entity = (*it);
 
     distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len());
@@ -213,10 +212,9 @@
 
 
-  list = ClassList::getList(CL_GENERIC_NPC);
-  if( list == NULL)
-    return false;
-  for( it = list->begin(); it != list->end(); it++)
-  {
-    entity = dynamic_cast<WorldEntity*>(*it);
+  for (ObjectList<GenericNPC>::const_iterator it = GenericNPC::objectList().begin();
+       it != GenericNPC::objectList().end();
+       ++it)
+  {
+    entity = (*it);
 
     distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len());
Index: trunk/src/world_entities/npcs/gate.h
===================================================================
--- trunk/src/world_entities/npcs/gate.h	(revision 9656)
+++ trunk/src/world_entities/npcs/gate.h	(revision 9869)
@@ -22,4 +22,6 @@
 class Gate : public WorldEntity
 {
+  ObjectListDeclaration(Gate);
+
   public:
     Gate(const TiXmlElement* root = NULL);
Index: trunk/src/world_entities/npcs/generic_npc.cc
===================================================================
--- trunk/src/world_entities/npcs/generic_npc.cc	(revision 9656)
+++ trunk/src/world_entities/npcs/generic_npc.cc	(revision 9869)
@@ -27,29 +27,33 @@
 
 #include "sound_buffer.h"
-
-#include "loading/resource_manager.h"
-
-
-CREATE_FACTORY(GenericNPC, CL_GENERIC_NPC);
+#include "resource_sound_buffer.h"
+
+#include "sound/resource_sound_buffer.h"
+
+#include "bsp_entity.h"
+
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(GenericNPC, CL_GENERIC_NPC);
+CREATE_FACTORY(GenericNPC);
 
 #include "script_class.h"
-CREATE_SCRIPTABLE_CLASS(GenericNPC, CL_GENERIC_NPC,
+CREATE_SCRIPTABLE_CLASS(GenericNPC,
                         // Move
-                        addMethod("walkTo", ExecutorLua3<GenericNPC,float,float,float>(&GenericNPC::walkTo))
-                        ->addMethod("runTo", ExecutorLua3<GenericNPC,float,float,float>(&GenericNPC::runTo))
-                        ->addMethod("turnTo", ExecutorLua1<GenericNPC,float>(&GenericNPC::turnTo))
-                        ->addMethod("finalGoalReached", ExecutorLua0ret<GenericNPC,bool>(&GenericNPC::finalGoalReached))
-                        ->addMethod("stop", ExecutorLua0<GenericNPC>(&GenericNPC::stop))
-                        ->addMethod("resume", ExecutorLua0<GenericNPC>(&GenericNPC::resume))
-                        ->addMethod("playAnimation", ExecutorLua2<GenericNPC,int,int>(&GenericNPC::playAnimation))
+                        addMethod("walkTo", Executor3<GenericNPC, lua_State*,float,float,float>(&GenericNPC::walkTo))
+                        ->addMethod("runTo", Executor3<GenericNPC, lua_State*,float,float,float>(&GenericNPC::runTo))
+                        ->addMethod("turnTo", Executor1<GenericNPC, lua_State*,float>(&GenericNPC::turnTo))
+                        ->addMethod("finalGoalReached", Executor0ret<GenericNPC, lua_State*,bool>(&GenericNPC::finalGoalReached))
+                        ->addMethod("stop", Executor0<GenericNPC, lua_State*>(&GenericNPC::stop))
+                        ->addMethod("resume", Executor0<GenericNPC, lua_State*>(&GenericNPC::resume))
+                        ->addMethod("playAnimation", Executor2<GenericNPC, lua_State*,int,int>(&GenericNPC::playAnimation))
                         // Display
-                        ->addMethod("hide", ExecutorLua0<WorldEntity>(&WorldEntity::hide))
-                        ->addMethod("unhide", ExecutorLua0<WorldEntity>(&WorldEntity::unhide))
+                        ->addMethod("hide", Executor0<WorldEntity, lua_State*>(&WorldEntity::hide))
+                        ->addMethod("unhide", Executor0<WorldEntity, lua_State*>(&WorldEntity::unhide))
                         // Coordinates
-                        ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
-                        ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
-                        ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
-                        ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
-                        ->addMethod("setAbsDir", ExecutorLua4<PNode,float,float,float,float>(&PNode::setAbsDir))
+                        ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
+                        ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
+                        ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
+                        ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
+                        ->addMethod("setAbsDir", Executor4<PNode, lua_State*,float,float,float,float>(&PNode::setAbsDir))
                        );
 
@@ -81,9 +85,9 @@
 void GenericNPC::init()
 {
-  this->setClassID(CL_GENERIC_NPC, "GenericNPC");
+  this->registerObject(this, GenericNPC::_objectList);
 
   this->toList(OM_GROUP_00);
 
-  this->soundBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/rain.wav", WAV);
+  this->soundBuffer = OrxSound::ResourceSoundBuffer("sound/rain.wav");
 
   time = 30.0f;
@@ -92,5 +96,5 @@
 
   // collision reaction registration
-   this->subscribeReaction(CREngine::CR_PHYSICS_GROUND_WALK, CL_BSP_ENTITY);
+  this->subscribeReaction(CREngine::CR_PHYSICS_GROUND_WALK, BspEntity::staticClassID());
 }
 
@@ -231,5 +235,5 @@
         this->setAnimationSpeed(0.5f);
       }
-        break;
+      break;
       case Run:
       {
@@ -244,5 +248,5 @@
         this->setAnimationSpeed(1.0f);
       }
-        break;
+      break;
       case Crouch:
       {
@@ -257,18 +261,18 @@
         this->setAnimationSpeed(1.0f);
       }
-        break;
+      break;
       case LookAt:
-        if( this->getAnimation() != STAND)
-          this->setAnimation(STAND, MD2_ANIM_LOOP);
-        break;
+      if( this->getAnimation() != STAND)
+        this->setAnimation(STAND, MD2_ANIM_LOOP);
+      break;
       case Shoot:
-        if( this->getAnimation() != STAND)
-          this->setAnimation(STAND, MD2_ANIM_LOOP);
-        break;
+      if( this->getAnimation() != STAND)
+        this->setAnimation(STAND, MD2_ANIM_LOOP);
+      break;
 
       default:
-        if( this->getAnimation() != STAND)
-          this->setAnimation(STAND, MD2_ANIM_LOOP);
-        break;
+      if( this->getAnimation() != STAND)
+        this->setAnimation(STAND, MD2_ANIM_LOOP);
+      break;
 
     }
@@ -304,5 +308,5 @@
         this->setAnimationSpeed(0.5f);
       }
-        break;
+      break;
       case Run:
       {
@@ -317,5 +321,5 @@
         this->setAnimationSpeed(1.0f);
       }
-        break;
+      break;
       case Crouch:
       {
@@ -330,5 +334,5 @@
         this->setAnimationSpeed(1.0f);
       }
-        break;
+      break;
       case LookAt:
       {
@@ -336,14 +340,14 @@
           this->setAnimation(STAND, MD2_ANIM_LOOP);
       }
-        break;
+      break;
       case Shoot:
-        if( this->getAnimation() != STAND)
+      if( this->getAnimation() != STAND)
         this->setAnimation(STAND, MD2_ANIM_LOOP);
-        break;
+      break;
 
       default:
-        if( this->getAnimation() != STAND)
+      if( this->getAnimation() != STAND)
         this->setAnimation(STAND, MD2_ANIM_LOOP);
-        break;
+      break;
 
     }
@@ -507,18 +511,18 @@
     {
       case Walk:
+      {
+        Vector dest = currentAnimation.v - this->getAbsCoor();
+        dest.y = 0.0f;
+        if (dest.len() < .5)
         {
-          Vector dest = currentAnimation.v - this->getAbsCoor();
-          dest.y = 0.0f;
-          if (dest.len() < .5)
-          {
-            this->nextStep();
-          }
-          else
-          {
-            Vector move = dest.getNormalized() * currentAnimation.speed * dt;
-            this->shiftCoor(move);
-          }
+          this->nextStep();
         }
-        break;
+        else
+        {
+          Vector move = dest.getNormalized() * currentAnimation.speed * dt;
+          this->shiftCoor(move);
+        }
+      }
+      break;
 
       case Run:
@@ -549,15 +553,15 @@
 
       case TurnTo:
-        //Quaternion direction = this->
-        break;
+      //Quaternion direction = this->
+      break;
 
       case LookAt:
-        break;
+      break;
 
       case Shoot:
-        break;
+      break;
 
       default:
-        break;
+      break;
 
     }
@@ -569,5 +573,5 @@
     this->fallVelocity += 300.0f * dt;
     //velocity -= Vector(0.0, 1.0, 0.0) * this->fallVelocity;
-   // PRINTF(0)("%s is not on ground\n", this->getName());
+    // PRINTF(0)("%s is not on ground\n", this->getName());
     this->shiftCoor(Vector(0, -this->fallVelocity * dt,0));
 
Index: trunk/src/world_entities/npcs/generic_npc.h
===================================================================
--- trunk/src/world_entities/npcs/generic_npc.h	(revision 9656)
+++ trunk/src/world_entities/npcs/generic_npc.h	(revision 9869)
@@ -25,4 +25,5 @@
 class GenericNPC : public NPC
 {
+  ObjectListDeclaration(GenericNPC);
 
 
@@ -123,5 +124,5 @@
 
    OrxSound::SoundSource                   soundSource;
-   OrxSound::SoundBuffer*                  soundBuffer;
+   OrxSound::SoundBuffer                   soundBuffer;
    float                                   soundVolume;
 
Index: trunk/src/world_entities/npcs/ground_turret.cc
===================================================================
--- trunk/src/world_entities/npcs/ground_turret.cc	(revision 9656)
+++ trunk/src/world_entities/npcs/ground_turret.cc	(revision 9869)
@@ -29,7 +29,8 @@
 #include "effects/explosion.h"
 
-CREATE_FACTORY(GroundTurret, CL_GROUND_TURRET);
+#include "class_id_DEPRECATED.h"
 
-
+ObjectListDefinitionID(GroundTurret, CL_GROUND_TURRET);
+CREATE_FACTORY(GroundTurret);
 
 
@@ -61,5 +62,5 @@
 void GroundTurret::init()
 {
-  this->setClassID(CL_GROUND_TURRET, "GroundTurret");
+  this->registerObject(this, GroundTurret::_objectList);
   this->loadModel("models/ground_turret_#.obj", 5);
   this->left = NULL;
Index: trunk/src/world_entities/npcs/ground_turret.h
===================================================================
--- trunk/src/world_entities/npcs/ground_turret.h	(revision 9656)
+++ trunk/src/world_entities/npcs/ground_turret.h	(revision 9869)
@@ -14,4 +14,5 @@
 class GroundTurret : public NPC
 {
+  ObjectListDeclaration(GroundTurret);
 
 public:
Index: trunk/src/world_entities/npcs/network_turret.cc
===================================================================
--- trunk/src/world_entities/npcs/network_turret.cc	(revision 9656)
+++ trunk/src/world_entities/npcs/network_turret.cc	(revision 9869)
@@ -30,8 +30,9 @@
 
 #include "weapons/aiming_turret.h"
+#include "debug.h"
 
-CREATE_FACTORY(NetworkTurret, CL_NETWORK_TURRET);
-
-
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(NetworkTurret, CL_NETWORK_TURRET);
+CREATE_FACTORY(NetworkTurret);
 
 
@@ -62,5 +63,5 @@
 void NetworkTurret::init()
 {
-  this->setClassID(CL_NETWORK_TURRET, "NetworkTurret");
+  this->registerObject(this, NetworkTurret::_objectList);
   this->loadModel("models/ground_turret_#.obj", 5);
 
@@ -111,6 +112,6 @@
   ObjectManager::EntityList::iterator entity;
   Vector diffVec;
-  for (entity = State::getObjectManager()->getObjectList((OM_LIST)this->targetGroup).begin();
-       entity != State::getObjectManager()->getObjectList((OM_LIST)this->targetGroup).end();
+  for (entity = State::getObjectManager()->getEntityList((OM_LIST)this->targetGroup).begin();
+       entity != State::getObjectManager()->getEntityList((OM_LIST)this->targetGroup).end();
        entity ++)
   {
Index: trunk/src/world_entities/npcs/network_turret.h
===================================================================
--- trunk/src/world_entities/npcs/network_turret.h	(revision 9656)
+++ trunk/src/world_entities/npcs/network_turret.h	(revision 9869)
@@ -14,5 +14,5 @@
 class NetworkTurret : public NPC
 {
-
+  ObjectListDeclaration(NetworkTurret);
 public:
   NetworkTurret(const TiXmlElement* root = NULL);
Index: trunk/src/world_entities/npcs/npc.cc
===================================================================
--- trunk/src/world_entities/npcs/npc.cc	(revision 9656)
+++ trunk/src/world_entities/npcs/npc.cc	(revision 9869)
@@ -20,8 +20,9 @@
 #include "npc.h"
 
+ObjectListDefinition(NPC);
 
 NPC::NPC(const TiXmlElement* root)
 {
-  this->setClassID(CL_NPC, "NPC");
+  this->registerObject(this, NPC::_objectList);
 
   this->toList(OM_GROUP_00);
Index: trunk/src/world_entities/npcs/npc.h
===================================================================
--- trunk/src/world_entities/npcs/npc.h	(revision 9656)
+++ trunk/src/world_entities/npcs/npc.h	(revision 9869)
@@ -8,5 +8,5 @@
 
 class NPC : public WorldEntity {
-
+  ObjectListDeclaration(NPC);
  public:
    NPC (const TiXmlElement* root);
Index: trunk/src/world_entities/npcs/npc_test.cc
===================================================================
--- trunk/src/world_entities/npcs/npc_test.cc	(revision 9656)
+++ trunk/src/world_entities/npcs/npc_test.cc	(revision 9869)
@@ -30,11 +30,12 @@
 #include "effects/explosion.h"
 
-CREATE_FACTORY(NPC2, CL_NPC_TEST2);
-
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(NPC2, CL_NPC_TEST2);
+CREATE_FACTORY(NPC2);
 
 NPC2::NPC2(const TiXmlElement* root)
   : NPC(NULL)
 {
-  this->setClassID(CL_NPC_TEST2, "NPC2");
+  this->registerObject(this, NPC2::_objectList);
 
   if ((float)rand()/RAND_MAX > .5f)
@@ -47,6 +48,6 @@
 
   this->shader = NULL;
-  if (likely(Shader::checkShaderAbility()))
-    this->shader = Shader::getShader("shaders/toon.vert", "shaders/toon.frag");
+//  if (likely(Shader::checkShaderAbility()))
+    //this->shader = Shader::getShader("shaders/toon.vert", "shaders/toon.frag");
 
   this->randomRotAxis = VECTOR_RAND(1);
@@ -58,8 +59,5 @@
 
 NPC2::~NPC2 ()
-{
-  if (this->shader)
-    Shader::unload(this->shader);
-}
+{}
 
 
Index: trunk/src/world_entities/npcs/npc_test.h
===================================================================
--- trunk/src/world_entities/npcs/npc_test.h	(revision 9656)
+++ trunk/src/world_entities/npcs/npc_test.h	(revision 9869)
@@ -9,4 +9,5 @@
 
 class NPC2 : public NPC {
+  ObjectListDeclaration(NPC2);
 
  public:
Index: trunk/src/world_entities/npcs/npc_test1.cc
===================================================================
--- trunk/src/world_entities/npcs/npc_test1.cc	(revision 9656)
+++ trunk/src/world_entities/npcs/npc_test1.cc	(revision 9869)
@@ -25,9 +25,10 @@
 #include "power_ups/laser_power_up.h"
 
+ObjectListDefinition(NPCTest1);
 
 NPCTest1::NPCTest1()
   : NPC(NULL)
 {
-  this->setClassID(CL_NPC_TEST1, "NPCTest1");
+  this->registerObject(this, NPCTest1::_objectList);
 
   if ((float)rand()/RAND_MAX > .5f)
Index: trunk/src/world_entities/npcs/npc_test1.h
===================================================================
--- trunk/src/world_entities/npcs/npc_test1.h	(revision 9656)
+++ trunk/src/world_entities/npcs/npc_test1.h	(revision 9869)
@@ -8,5 +8,5 @@
 
 class NPCTest1 : public NPC {
-
+  ObjectListDeclaration(NPCTest1);
  public:
   NPCTest1 ();
Index: trunk/src/world_entities/npcs/repair_station.cc
===================================================================
--- trunk/src/world_entities/npcs/repair_station.cc	(revision 9656)
+++ trunk/src/world_entities/npcs/repair_station.cc	(revision 9869)
@@ -25,11 +25,8 @@
 
 #include "repair_station.h"
-#include "class_list.h"
 
-
-
-
-
-CREATE_FACTORY(RepairStation, CL_DOOR);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(RepairStation, CL_DOOR +1 );
+CREATE_FACTORY(RepairStation);
 
 
@@ -67,6 +64,5 @@
 RepairStation::RepairStation(const TiXmlElement* root)
 {
-
-  this->setClassID(CL_DOOR, "RepairStation");
+  this->registerObject(this, RepairStation::_objectList);
   this->scale = 1.0f;
 
Index: trunk/src/world_entities/npcs/repair_station.h
===================================================================
--- trunk/src/world_entities/npcs/repair_station.h	(revision 9656)
+++ trunk/src/world_entities/npcs/repair_station.h	(revision 9869)
@@ -27,4 +27,5 @@
 class RepairStation : public WorldEntity
 {
+  ObjectListDeclaration(RepairStation);
   public:
     RepairStation ();
Index: trunk/src/world_entities/npcs/space_turret.cc
===================================================================
--- trunk/src/world_entities/npcs/space_turret.cc	(revision 9656)
+++ trunk/src/world_entities/npcs/space_turret.cc	(revision 9869)
@@ -29,5 +29,7 @@
 #include "effects/explosion.h"
 
-CREATE_FACTORY(SpaceTurret, CL_SPACE_TURRET);
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(SpaceTurret, CL_SPACE_TURRET);
+CREATE_FACTORY(SpaceTurret);
 
 /**
@@ -36,5 +38,5 @@
  */
 SpaceTurret::SpaceTurret(const TiXmlElement* root)
-  : NPC(root)
+    : NPC(root)
 {
   this->init();
@@ -48,7 +50,5 @@
  */
 SpaceTurret::~SpaceTurret ()
-{
-
-}
+{}
 
 
@@ -59,5 +59,5 @@
 void SpaceTurret::init()
 {
-  this->setClassID(CL_SPACE_TURRET, "SpaceTurret");
+  this->registerObject(this, SpaceTurret::_objectList);
   this->loadModel("models/ground_turret_#.obj", 7.5);
   this->loadModel("models/comet.obj", 1.0f, 3);
@@ -98,6 +98,8 @@
 
   element = root->FirstChildElement("weapon-left");
-  if (element != NULL) element = element->FirstChildElement();
-  this->left = dynamic_cast<Weapon*>( Factory::fabricate( element) );
+  if (element != NULL)
+    element = element->FirstChildElement();
+  if (element != NULL)
+    this->left = dynamic_cast<Weapon*>( Factory::fabricate( element) );
   if (this->left)
   {
@@ -112,6 +114,8 @@
 
   element = root->FirstChildElement("weapon-right");
-  if (element != NULL)  if (element != NULL) element = element->FirstChildElement();
-  this->right = dynamic_cast<Weapon*>( Factory::fabricate( element) );
+  if (element != NULL)
+    element = element->FirstChildElement();
+  if (element != NULL)
+    this->right = dynamic_cast<Weapon*>( Factory::fabricate( element) );
   if (this->right)
   {
@@ -132,7 +136,5 @@
  */
 void SpaceTurret::setWeaponLeft(const std::string& wLeft)
-{
-
-}
+{}
 
 /**
@@ -150,17 +152,17 @@
 {
   if(this->getHealth() > 0.0f && State::getPlayer() &&
-     State::getPlayer()->getPlayable() &&
-     State::getPlayer()->getPlayable()->distance(this) < 300) // HACK
-  {
-  if (likely(this->left != NULL))
-  {
-//    this->left->tickW(dt);
-    this->left->requestAction(WA_SHOOT);
-  }
-  if (likely(this->right != NULL))
-  {
-//    this->right->tickW(dt);
-    this->right->requestAction(WA_SHOOT);
-  }
+      State::getPlayer()->getPlayable() &&
+      State::getPlayer()->getPlayable()->distance(this) < 300) // HACK
+  {
+    if (likely(this->left != NULL))
+    {
+      //    this->left->tickW(dt);
+      this->left->requestAction(WA_SHOOT);
+    }
+    if (likely(this->right != NULL))
+    {
+      //    this->right->tickW(dt);
+      this->right->requestAction(WA_SHOOT);
+    }
   }
 }
@@ -183,9 +185,9 @@
     this->getModel(3)->draw();
   glPopMatrix();
-/*
-  if (this->left != NULL)
-    this->left->draw();
-  if (this->right != NULL)
-    this->right->draw();*/
+  /*
+    if (this->left != NULL)
+      this->left->draw();
+    if (this->right != NULL)
+      this->right->draw();*/
 }
 
@@ -197,7 +199,5 @@
  */
 void SpaceTurret::postSpawn ()
-{
-
-}
+{}
 
 /**
@@ -206,7 +206,5 @@
  */
 void SpaceTurret::leftWorld ()
-{
-
-}
+{}
 
 void SpaceTurret::destroy(WorldEntity* killer)
Index: trunk/src/world_entities/npcs/space_turret.h
===================================================================
--- trunk/src/world_entities/npcs/space_turret.h	(revision 9656)
+++ trunk/src/world_entities/npcs/space_turret.h	(revision 9869)
@@ -18,4 +18,5 @@
 class SpaceTurret : public NPC
 {
+  ObjectListDeclaration(SpaceTurret);
 
 public:
