Index: trunk/src/lib/graphics/light.cc
===================================================================
--- trunk/src/lib/graphics/light.cc	(revision 5978)
+++ trunk/src/lib/graphics/light.cc	(revision 5982)
@@ -274,5 +274,5 @@
   while (element != NULL)
   {
-    Factory::getFirst()->fabricate(element);
+    Factory::fabricate(element);
 
     element = element->NextSiblingElement();
Index: trunk/src/lib/math/vector.h
===================================================================
--- trunk/src/lib/math/vector.h	(revision 5978)
+++ trunk/src/lib/math/vector.h	(revision 5982)
@@ -21,6 +21,6 @@
 */
 
-#ifndef _VECTOR_H
-#define _VECTOR_H
+#ifndef __VECTOR_H_
+#define __VECTOR_H_
 
 #include <math.h>
@@ -318,4 +318,4 @@
 
 
-#endif /* _VECTOR_H */
-
+#endif /* __VECTOR_H_ */
+
Index: trunk/src/lib/physics/physics_engine.cc
===================================================================
--- trunk/src/lib/physics/physics_engine.cc	(revision 5978)
+++ trunk/src/lib/physics/physics_engine.cc	(revision 5982)
@@ -103,5 +103,5 @@
   while (element != NULL)
   {
-    Factory::getFirst()->fabricate(element);
+    Factory::fabricate(element);
 
     element = element->NextSiblingElement();
@@ -119,5 +119,5 @@
   while (element != NULL)
   {
-    Factory::getFirst()->fabricate(element);
+    Factory::fabricate(element);
 
     element = element->NextSiblingElement();
Index: trunk/src/lib/sound/sound_engine.cc
===================================================================
--- trunk/src/lib/sound/sound_engine.cc	(revision 5978)
+++ trunk/src/lib/sound/sound_engine.cc	(revision 5982)
@@ -286,8 +286,8 @@
 
 
-  }
-
+
+  }
   // INITIALIZING THE DEVICE:
-#ifdef AL_VERSION_1_1
+#ifndef AL_VERSION_1_1
   ALubyte deviceName[] =
 #else
@@ -304,6 +304,5 @@
   this->context = alcCreateContext(this->device, NULL);
 
-  alcMakeContextCurrent(this->context);
-
+  alcMakeContextCurrent(this->context); 
 
   if ((result = alGetError()) != AL_NO_ERROR)
Index: trunk/src/orxonox.cc
===================================================================
--- trunk/src/orxonox.cc	(revision 5978)
+++ trunk/src/orxonox.cc	(revision 5982)
@@ -93,5 +93,5 @@
 
   // class-less services/factories
-  delete Factory::getFirst();
+  Factory::deleteFactories();
   FastFactory::deleteAll();
   ShellCommandClass::unregisterAllCommands();
Index: trunk/src/story_entities/campaign.cc
===================================================================
--- trunk/src/story_entities/campaign.cc	(revision 5978)
+++ trunk/src/story_entities/campaign.cc	(revision 5982)
@@ -19,4 +19,5 @@
 #include "campaign.h"
 
+#include "factory.h"
 #include "game_loader.h"
 #include "story_entity.h"
@@ -90,5 +91,5 @@
   {
     PRINTF(5)("Campaign: Constructor: adding a world\n");
-    StoryEntity* created = (StoryEntity*) GameLoader::getInstance()->fabricate(element);
+    StoryEntity* created = (StoryEntity*) Factory::fabricate(element);
     if( created != NULL)
     {
Index: trunk/src/story_entities/world.cc
===================================================================
--- trunk/src/story_entities/world.cc	(revision 5978)
+++ trunk/src/story_entities/world.cc	(revision 5982)
@@ -317,10 +317,10 @@
       while( element != NULL)
         {
-          BaseObject* created = (loader->fabricate(element));
+          BaseObject* created = (Factory::fabricate(element));
           if( created != NULL )
           {
             if(created->isA(CL_WORLD_ENTITY))
               this->spawn(dynamic_cast<WorldEntity*>(created));
-            printf("Created a %s: %s\n", created->getClassName(), created->getName());
+            PRINTF(4)("Created a %s: %s\n", created->getClassName(), created->getName());
           }
 
Index: trunk/src/util/loading/factory.cc
===================================================================
--- trunk/src/util/loading/factory.cc	(revision 5978)
+++ trunk/src/util/loading/factory.cc	(revision 5982)
@@ -13,13 +13,13 @@
    co-programmer: Benjamin Grauer
 */
-
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LOADING
 
 #include "factory.h"
 
-#include "shell_command.h"
-#include "game_loader.h"
+//#include "shell_command.h"
+
 using namespace std;
 
-SHELL_COMMAND(create, Factory, fabricate);
+//SHELL_COMMAND(create, Factory, fabricate);
 
 
@@ -39,18 +39,21 @@
   this->setName(factoryName);
 
-  this->next = NULL;
   this->classID = classID;
+  this->className = factoryName;
 
-  Factory::registerFactory(this);
+  if( Factory::factoryList == NULL)
+    Factory::factoryList = new std::list<Factory*>;
+
+  Factory::factoryList->push_back(this);
 }
 
 /** a reference to the First Factory */
-Factory* Factory::first = NULL;
+std::list<Factory*>* Factory::factoryList = NULL;
 
 /**
  *  destructor
-
-   clear the Q
-*/
+ *
+ * clear the Q
+ */
 Factory::~Factory ()
 {
@@ -58,52 +61,96 @@
   //  Factory* tmpDel = this->next;
   //  this->next = NULL;
-  if (this->next)
-    delete this->next;
 }
 
+void Factory::deleteFactories()
+{
+  if (Factory::factoryList != NULL)
+  {
+    while(!Factory::factoryList->empty())
+    {
+      delete Factory::factoryList->front();
+      Factory::factoryList->pop_front();
+    }
+    delete Factory::factoryList;
+    Factory::factoryList = NULL;
+  }
+}
+
+
 /**
- *  add a Factory to the Factory Queue
- * @param factory a Factory to be registered
-*/
-void Factory::registerFactory( Factory* factory)
+ * Compares the Factories Name against a given ClassName
+ * @param className the Name of the Class to Query
+ * @returns true on match, false otherwise.
+ */
+bool Factory::operator==(const char* className) const
 {
-  assert( factory != NULL);
+  return(className != NULL && !strcmp(className, this->className));
+}
 
-  PRINTF(5)("Registered factory for '%s'\n", factory->getName());
 
-  if( Factory::first == NULL)
+BaseObject* Factory::fabricate(const TiXmlElement* root)
+{
+  if (root == NULL || Factory::factoryList == NULL)
+    return NULL;
+
+  std::list<Factory*>::const_iterator factory;
+  for (factory = Factory::factoryList->begin(); factory != Factory::factoryList->end(); factory++)
+    if (*(*factory) == root->Value())
+      break;
+
+  if (factory != Factory::factoryList->end())
   {
-    Factory::first = factory;
+    PRINTF(4)("Create a new Object of type %s\n", (*factory)->getName());
+    return (*factory)->fabricateObject(root);
   }
   else
   {
-    Factory* tmpFac = Factory::first;
-    while( tmpFac->next != NULL)
-    {
-      tmpFac = tmpFac->next;
-    }
-    tmpFac->setNext(factory);
+    PRINTF(2)("Could not Fabricate an Object of Class '%s'\n", root->Value());
+    return NULL;
   }
 }
 
-void Factory::fabricate(const char* className, const char* entityName)
+BaseObject* Factory::fabricate(const char* className)
 {
-  if (className == NULL)
-    return;
-  Factory* fac = Factory::first;
+  if (className == NULL || Factory::factoryList == NULL)
+    return NULL;
 
-  while (fac != NULL)
+  std::list<Factory*>::const_iterator factory;
+  for (factory = Factory::factoryList->begin(); factory != Factory::factoryList->end(); factory++)
+    if (*(*factory) == className)
+      break;
+
+  if (factory != Factory::factoryList->end())
   {
-    if (!strcmp(className, fac->getName()))
-    {
-      PRINTF(3)("Create a new Object of type %s\n", fac->getName());
-      BaseObject* object = fac->fabricateDirect();
-      if (object != NULL)
-      {
-        object->setName(entityName);
-      }
-      break;
-    }
-    fac = fac->next;
+    PRINTF(4)("Create a new Object of type %s\n", (*factory)->getName());
+    return (*factory)->fabricateObject(NULL);
+  }
+  else
+  {
+    PRINTF(2)("Could not Fabricate an Object of Class '%s'\n", className);
+    return NULL;
   }
 }
+
+
+BaseObject* Factory::fabricate(ClassID classID)
+{
+  if (Factory::factoryList == NULL)
+    return NULL;
+
+  std::list<Factory*>::const_iterator factory;
+  for (factory = Factory::factoryList->begin(); factory != Factory::factoryList->end(); factory++)
+    if (*(*factory) == classID)
+      break;
+
+  if (factory != Factory::factoryList->end())
+  {
+    PRINTF(4)("Create a new Object of type %s\n", (*factory)->getName());
+    return (*factory)->fabricateObject(NULL);
+  }
+  else
+  {
+    PRINTF(2)("Could not Fabricate an Object of ClassID '%h'\n", classID);
+    return NULL;
+  }
+}
Index: trunk/src/util/loading/factory.h
===================================================================
--- trunk/src/util/loading/factory.h	(revision 5978)
+++ trunk/src/util/loading/factory.h	(revision 5982)
@@ -28,4 +28,5 @@
 #include "base_object.h"
 #include "debug.h"
+#include <vector>
 
 /**
@@ -40,29 +41,23 @@
 
  public:
-  Factory (const char* factoryName = NULL, ClassID classID = CL_NULL);
+  Factory (const char* factoryName, ClassID classID);
   virtual ~Factory ();
 
-  void fabricate(const char* className, const char* entityName);
-  virtual BaseObject* fabricate(ClassID classID) = NULL;
-  virtual BaseObject* fabricate(const TiXmlElement* root) = NULL;
-  virtual BaseObject* fabricateDirect() = NULL;
+  static void deleteFactories();
 
-  static void registerFactory( Factory* factory);
-  /** @returns the first factory */
-  static Factory* getFirst() { return Factory::first; };
+  static  BaseObject* fabricate(const char* className);
+  static  BaseObject* fabricate(ClassID classID);
+  static  BaseObject* fabricate(const TiXmlElement* root = NULL);
+
+  bool operator==(ClassID classID) const { return (this->classID == classID); };
+  bool operator==(const char* className) const;
 
   protected:
-    /** sets the Next factory in the list @param nextFactory the next factory */
-    inline void setNext( Factory* nextFactory) { this->next = nextFactory; };
-    /** @returns the next factory */
-    Factory* getNext() const { return this->next; };
-
+    virtual BaseObject* fabricateObject(const TiXmlElement* root = NULL) const = 0;
 
   protected:
-    ClassID           classID;              //!< The CLass-Identifyer of the Factory.
-
-  private:
-    Factory*          next;                 //!< pointer to the next factory.
-    static Factory*   first;                //!< A pointer to the first factory.
+    ClassID                       classID;              //!< The Class-Identifyer of the Factory.
+    const char*                   className;            //!< The name of the Class.
+    static std::list<Factory*>*   factoryList;          //!< List of Registered Factories
 };
 
@@ -73,75 +68,21 @@
 template<class T> class tFactory : public Factory
 {
-  public:
-    tFactory(const char* factoryName, ClassID classID);
-    virtual ~tFactory();
+ public:
+  tFactory (const char* factoryName, ClassID classID)
+   : Factory(factoryName, classID)
+  {
+  }
 
   private:
-    virtual BaseObject* fabricate(ClassID classID);
-    virtual BaseObject* fabricate(const TiXmlElement* root);
-    virtual BaseObject* fabricateDirect();
+   /**
+    * fabricates an Object of type T, with the constructor T::T(const TiXmlElemnt*)
+    * @param root the TiXmlElement T should load parameters from.
+    * @return the newly fabricated T.
+    */
+    virtual BaseObject* fabricateObject(const TiXmlElement* root = NULL) const
+    {
+      return new T(root);
+    }
 };
-
-/**
- *  construnts a factory with
- * @param factoryName the name of the factory
-*/
-template<class T>
-    tFactory<T>::tFactory(const char* factoryName, ClassID classID) : Factory(factoryName, classID)
-{
-  PRINTF(4)("Class: %s loadable\n", this->getName());
-}
-
-/**
- * destructs the type-Factory
- */
-template<class T>
-    tFactory<T>::~tFactory()
-{}
-
-/**
- * fabricates an Object of type T, with the constructor T::T(const TiXmlElemnt*)
- * @param root the TiXmlElement T should load parameters from.
- * @return the newly fabricated T, NULL otherwise.
- */
-template<class T>
-    BaseObject* tFactory<T>::fabricate(const TiXmlElement* root)
-{
-  if (root == NULL)
-    return NULL;
-
-  if(!strcmp(root->Value(), this->getName()))
-    return new T ( root);
-  else if( getNext() != NULL)
-    return getNext()->fabricate( root);
-  else
-    return NULL;
-}
-
-
-/**
- * fabricates an Object of type T, with the constructor T::T(const TiXmlElemnt*)
- * @param classID the ClassID of T that should be created.
- * @return the newly fabricated T if fabricated NULL otherwise.
- */
-template<class T>
-    BaseObject* tFactory<T>::fabricate(ClassID classID)
-{
-  if(classID == this->classID)
-    return this->fabricateDirect();
-  else if( getNext() != NULL)
-    return getNext()->fabricate( classID);
-  else
-    return NULL;
-}
-
-/**
- * directly fabricate an Entity of this factory.
- */
-template<class T>
-    BaseObject* tFactory<T>::fabricateDirect()
-{
-  return new T((const TiXmlElement*)NULL);
-}
 
 #endif /* _FACTORY_H */
Index: trunk/src/util/loading/game_loader.cc
===================================================================
--- trunk/src/util/loading/game_loader.cc	(revision 5978)
+++ trunk/src/util/loading/game_loader.cc	(revision 5982)
@@ -331,32 +331,2 @@
     this->currentCampaign->previousLevel();
 }
-
-/**
- *  load a StoryEntity
- * @param element a XMLElement containing all the needed info
-*/
-BaseObject* GameLoader::fabricate(const TiXmlElement* element)
-{
-  assert( element != NULL);
-
-  if( Factory::getFirst() == NULL)
-    {
-      PRINTF(1)("GameLoader does not know any factories, fabricate() failed\n");
-      return NULL;
-    }
-
-  if( element->Value() != NULL)
-    {
-      PRINTF(4)("Attempting fabrication of a '%s'\n", element->Value());
-      BaseObject* b = Factory::getFirst()->fabricate( element);
-      if( b == NULL)
-        PRINTF(2)("Failed to fabricate a '%s'\n", element->Value());
-      else
-        PRINTF(4)("Successfully fabricated a '%s'\n", element->Value());
-      return b;
-    }
-
-  PRINTF(2)("Fabricate failed, TiElement did not contain a value\n");
-
-  return NULL;
-}
Index: trunk/src/util/loading/game_loader.h
===================================================================
--- trunk/src/util/loading/game_loader.h	(revision 5978)
+++ trunk/src/util/loading/game_loader.h	(revision 5982)
@@ -60,7 +60,4 @@
   ErrorMessage loadDebugCampaign(Uint32 campaignID);
 
-  void registerFactory( Factory* factory );
-  BaseObject* fabricate(const TiXmlElement* data);
-
   void process(const Event &event);
 
Index: trunk/src/world_entities/space_ships/space_ship.cc
===================================================================
--- trunk/src/world_entities/space_ships/space_ship.cc	(revision 5978)
+++ trunk/src/world_entities/space_ships/space_ship.cc	(revision 5982)
@@ -88,5 +88,5 @@
   Weapon* wpLeft = new TestGun(1);
   wpLeft->setName("testGun Left");
-  Weapon* cannon = dynamic_cast<Weapon*>(Factory::getFirst()->fabricate(CL_CANNON));
+  Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate(CL_CANNON));
 
   cannon->setName("BFG");
@@ -118,7 +118,7 @@
   xMouse = yMouse = 0;
   mouseSensitivity = 0.001;
-  
+
   cycle = 0.0;
-  
+
 
   travelSpeed = 15.0;
@@ -271,10 +271,10 @@
 
   //orient the spaceship model in the direction of movement.
-  
+
   // this is the air friction (necessary for a smooth control)
   if(velocity.len() != 0) velocity -= velocity*0.01;
-  
+
   this->shiftCoor(Vector(0,1,0)*cos(this->cycle*2.0)*0.02);
-  
+
   //SDL_WarpMouse(GraphicsEngine::getInstance()->getResolutionX()/2, GraphicsEngine::getInstance()->getResolutionY()/2);
 
@@ -327,5 +327,5 @@
     //rotVal += .4;
   }
-  
+
   if( this->bRollL /* > -this->getRelCoor().z*2*/)
   {
@@ -385,6 +385,6 @@
 void SpaceShip::process(const Event &event)
 {
-  
-  
+
+
   if( event.type == SDLK_a)
       this->bRollL = event.bPressed;
Index: trunk/src/world_entities/weapons/ground_turret.cc
===================================================================
--- trunk/src/world_entities/weapons/ground_turret.cc	(revision 5978)
+++ trunk/src/world_entities/weapons/ground_turret.cc	(revision 5982)
@@ -85,5 +85,5 @@
   element = root->FirstChildElement("weapon-left");
   if (element != NULL) element = element->FirstChildElement();
-  this->left = dynamic_cast<Weapon*>( Factory::getFirst()->fabricate( element) );
+  this->left = dynamic_cast<Weapon*>( Factory::fabricate( element) );
   if (this->left)
   {
@@ -94,5 +94,5 @@
   element = root->FirstChildElement("weapon-right");
   if (element != NULL)  if (element != NULL) element = element->FirstChildElement();
-  this->right = dynamic_cast<Weapon*>( Factory::getFirst()->fabricate( element) );
+  this->right = dynamic_cast<Weapon*>( Factory::fabricate( element) );
   if (this->right)
   {
Index: trunk/src/world_entities/weapons/weapon_manager.cc
===================================================================
--- trunk/src/world_entities/weapons/weapon_manager.cc	(revision 5978)
+++ trunk/src/world_entities/weapons/weapon_manager.cc	(revision 5982)
@@ -140,5 +140,5 @@
   LOAD_PARAM_START_CYCLE(root, element);
 
-  Weapon* newWeapon = dynamic_cast<Weapon*>(Factory::getFirst()->fabricate(element));
+  Weapon* newWeapon = dynamic_cast<Weapon*>(Factory::fabricate(element));
   /// @todo implement this !!
 
