Index: /orxonox/trunk/src/Makefile.am
===================================================================
--- /orxonox/trunk/src/Makefile.am	(revision 4939)
+++ /orxonox/trunk/src/Makefile.am	(revision 4940)
@@ -41,4 +41,5 @@
                   util/animation/animation_player.cc \
                   util/object_manager.cc \
+                  util/fast_factory.cc \
                   util/garbage_collector.cc \
                   util/resource_manager.cc \
@@ -93,4 +94,5 @@
                  util/animation/animation_player.h \
                  util/object_manager.h \
+                 util/fast_factory.h \
                  util/garbage_collector.h \
                  util/state.h \
Index: /orxonox/trunk/src/Makefile.in
===================================================================
--- /orxonox/trunk/src/Makefile.in	(revision 4939)
+++ /orxonox/trunk/src/Makefile.in	(revision 4940)
@@ -59,4 +59,5 @@
 	orxonox-animation_player.$(OBJEXT) \
 	orxonox-object_manager.$(OBJEXT) \
+	orxonox-fast_factory.$(OBJEXT) \
 	orxonox-garbage_collector.$(OBJEXT) \
 	orxonox-resource_manager.$(OBJEXT) orxonox-factory.$(OBJEXT) \
@@ -100,4 +101,5 @@
 @AMDEP_TRUE@	./$(DEPDIR)/orxonox-environment.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/orxonox-factory.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/orxonox-fast_factory.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/orxonox-game_loader.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/orxonox-garbage_collector.Po \
@@ -292,4 +294,5 @@
                   util/animation/animation_player.cc \
                   util/object_manager.cc \
+                  util/fast_factory.cc \
                   util/garbage_collector.cc \
                   util/resource_manager.cc \
@@ -344,4 +347,5 @@
                  util/animation/animation_player.h \
                  util/object_manager.h \
+                 util/fast_factory.h \
                  util/garbage_collector.h \
                  util/state.h \
@@ -491,4 +495,5 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-environment.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-factory.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-fast_factory.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-game_loader.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-garbage_collector.Po@am__quote@
@@ -685,4 +690,20 @@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o orxonox-object_manager.obj `if test -f 'util/object_manager.cc'; then $(CYGPATH_W) 'util/object_manager.cc'; else $(CYGPATH_W) '$(srcdir)/util/object_manager.cc'; fi`
+
+orxonox-fast_factory.o: util/fast_factory.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT orxonox-fast_factory.o -MD -MP -MF "$(DEPDIR)/orxonox-fast_factory.Tpo" -c -o orxonox-fast_factory.o `test -f 'util/fast_factory.cc' || echo '$(srcdir)/'`util/fast_factory.cc; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/orxonox-fast_factory.Tpo" "$(DEPDIR)/orxonox-fast_factory.Po"; else rm -f "$(DEPDIR)/orxonox-fast_factory.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='util/fast_factory.cc' object='orxonox-fast_factory.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/orxonox-fast_factory.Po' tmpdepfile='$(DEPDIR)/orxonox-fast_factory.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o orxonox-fast_factory.o `test -f 'util/fast_factory.cc' || echo '$(srcdir)/'`util/fast_factory.cc
+
+orxonox-fast_factory.obj: util/fast_factory.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT orxonox-fast_factory.obj -MD -MP -MF "$(DEPDIR)/orxonox-fast_factory.Tpo" -c -o orxonox-fast_factory.obj `if test -f 'util/fast_factory.cc'; then $(CYGPATH_W) 'util/fast_factory.cc'; else $(CYGPATH_W) '$(srcdir)/util/fast_factory.cc'; fi`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/orxonox-fast_factory.Tpo" "$(DEPDIR)/orxonox-fast_factory.Po"; else rm -f "$(DEPDIR)/orxonox-fast_factory.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='util/fast_factory.cc' object='orxonox-fast_factory.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/orxonox-fast_factory.Po' tmpdepfile='$(DEPDIR)/orxonox-fast_factory.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o orxonox-fast_factory.obj `if test -f 'util/fast_factory.cc'; then $(CYGPATH_W) 'util/fast_factory.cc'; else $(CYGPATH_W) '$(srcdir)/util/fast_factory.cc'; fi`
 
 orxonox-garbage_collector.o: util/garbage_collector.cc
Index: /orxonox/trunk/src/story_entities/world.cc
===================================================================
--- /orxonox/trunk/src/story_entities/world.cc	(revision 4939)
+++ /orxonox/trunk/src/story_entities/world.cc	(revision 4940)
@@ -43,5 +43,5 @@
 #include "track_manager.h"
 #include "garbage_collector.h"
-#include "object_manager.h"
+#include "fast_factory.h"
 #include "animation_player.h"
 #include "particle_engine.h"
Index: /orxonox/trunk/src/util/fast_factory.cc
===================================================================
--- /orxonox/trunk/src/util/fast_factory.cc	(revision 4940)
+++ /orxonox/trunk/src/util/fast_factory.cc	(revision 4940)
@@ -0,0 +1,249 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+### File Specific:
+   main-programmer: Benjamin Grauer
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_OBJECT_MANAGER
+
+#include "fast_factory.h"
+#include "compiler.h"
+#include "debug.h"
+
+using namespace std;
+
+/**
+ * Initializes a FastFactory
+ * @param classID the ClassID this Class belongs to (the top-most)
+ * @param fastFactoryName the Name of the ObjectClass-handled here
+ * @return a new FastFactory
+ */
+FastFactory::FastFactory (ClassID classID, const char* fastFactoryName)
+{
+  this->setClassID(CL_FAST_FACTORY, "FastFactory");
+  this->setName(fastFactoryName);
+
+  this->storedClassID = classID;
+  this->next = NULL;
+
+  this->deadList = NULL;
+  this->unusedContainers = NULL;
+
+  this->storedDeadObjects = 0;
+
+  FastFactory::registerFastFactory(this);
+}
+
+/** a reference to the First FastFactory */
+FastFactory* FastFactory::first = NULL;
+
+/**
+ *  destructor
+ * deletes all the Instances of the FastFactory.
+ */
+FastFactory::~FastFactory ()
+{
+  if (this == first)
+    this->first = NULL;
+
+  if (this->next)
+    delete this->next;
+}
+
+/**
+ * registers a Factory to the List of known factories.
+ * @param fastFactory The factory to add
+ *
+ * needed, to step through all the FastFactories.
+ */
+void FastFactory::registerFastFactory(FastFactory* fastFactory)
+{
+  PRINTF(4)("Registered FastFactory for '%s'\n", fastFactory->getName());
+
+  if( FastFactory::first == NULL)
+    FastFactory::first = fastFactory;
+  else
+  {
+    FastFactory* tmpFac = FastFactory::first;
+    while( tmpFac->next != NULL)
+      tmpFac = tmpFac->next;
+    tmpFac->setNext(fastFactory);
+  }
+}
+
+
+/**
+ * searches for a FastFactory
+ * @param factoryName the Name of the Factory to search for (not used)
+ * @param classID the ClassID of the FastFactory to search for
+ * @returns true if found, false otherwise.
+ */
+FastFactory* FastFactory::searchFastFactory(ClassID classID, const char* fastFactoryName)
+{
+  if (FastFactory::first == NULL)
+    return NULL;
+  else
+  {
+    FastFactory* tmpFac = FastFactory::first;
+    while (tmpFac != NULL)
+    {
+      if (tmpFac->storedClassID == classID)
+        return tmpFac;
+      tmpFac = tmpFac->next;
+    }
+  }
+  return NULL;
+}
+
+/**
+ * Removes all the stored Containers, and sets the Lists back to emptienes.
+ * @param hardFLUSH if true the containing Objects will also be deleted !! THIS IS DANGEROUS !!
+ */
+void FastFactory::flushAll(bool hardFLUSH)
+{
+  FastFactory* tmpFac = FastFactory::first;
+  while (tmpFac != NULL)
+  {
+    tmpFac->flush(hardFLUSH);
+    tmpFac = tmpFac->next;
+  }
+}
+
+
+/**
+ * ereases all the remaining containers, without deleting the stored Objects inside of them.
+ * @param hardFLUSH if the the containing Objects will also be deleted !! THIS IS DANGEROUS !!
+ */
+void FastFactory::flush(bool hardFLUSH)
+{
+  FastObjectMember* tmpMember = this->deadList, *delMember = NULL;
+  while (tmpMember != NULL)
+  {
+    delMember = tmpMember;
+    tmpMember = tmpMember->next;
+    if (unlikely(hardFLUSH == true))
+      delete delMember->objectPointer;
+    delete delMember;
+  }
+  this->deadList = NULL;
+
+  tmpMember = this->unusedContainers;
+  while (tmpMember != NULL)
+  {
+    delMember = tmpMember;
+    tmpMember = tmpMember->next;
+    delete delMember;
+  }
+  this->unusedContainers = NULL;
+}
+
+/**
+ * generates count new Object of the Corresponding class. (precaching)
+ * @param count How many instances of the class should be generated.
+ */
+void FastFactory::prepare(unsigned int count)
+{
+/*  if (this->storedDeadObjects + this->storedLivingObjects >= count)
+  {
+  PRINTF(3)("not creating new Objects for class %s, because the requested count already exists\n", this->getClassName());
+}*/
+  for (int i = this->storedDeadObjects; i < count; i++)
+  {
+    this->fabricate();
+  }
+}
+
+/**
+ * gives back live to one Object.
+ * @return the Object to resurrect.
+ */
+BaseObject* FastFactory::resurrect()
+{
+  PRINTF(4)("Resurecting Object of type %s\n", this->getName());
+  if (unlikely(this->deadList == NULL))
+  {
+    PRINTF(2)("The deadList of Class %s is empty, this may be either because it has not been filled yet, or the cache is to small.\n" \
+        "Fabricating a new %s", this->getName(), this->getName());
+    this->fabricate();
+    return this->resurrect();
+  }
+  else
+  {
+    FastObjectMember* tmpC = deadList;
+    this->deadList = this->deadList->next;
+
+    tmpC->next = this->unusedContainers;
+    this->unusedContainers = tmpC;
+
+    return tmpC->objectPointer;
+  }
+}
+
+/**
+ * gives back live to one Object.
+ * @param classID the class From which to resurrect an Object.
+ * @return the Object to resurrect, NULL if classID is not found.
+ */
+BaseObject* FastFactory::resurrect(ClassID classID)
+{
+  FastFactory* tmpFac = FastFactory::getFirst();
+
+  while (tmpFac != NULL)
+  {
+    if (classID == tmpFac->storedClassID)
+      return tmpFac->resurrect();
+    tmpFac = tmpFac->next;
+  }
+  return NULL;
+}
+
+/**
+ * kills Object object, meaning, that it will be stored in the deadList of the FastFactory, and waiting for resurrection
+ * @param object the Object to kill.
+ *
+ * synony that would be really grate would be abolish, but this is more like exterminate than pause-mode.
+ */
+void FastFactory::kill(BaseObject* object)
+{
+  FastObjectMember* tmpC;
+  if (unlikely(this->unusedContainers == NULL))
+  {
+    tmpC = new FastObjectMember;
+  }
+  else
+  {
+    tmpC = this->unusedContainers;
+    this->unusedContainers = this->unusedContainers->next;
+  }
+
+  tmpC->next = this->deadList;
+  tmpC->objectPointer = object;
+  this->deadList = tmpC;
+}
+
+
+void FastFactory::kill(BaseObject* object, bool searchForFastFactory)
+{
+  if (likely(searchForFastFactory == true))
+  {
+    FastFactory* tmpFac = FastFactory::first;
+    while (tmpFac != NULL)
+    {
+      if (object->isA(tmpFac->storedClassID))
+      {
+        tmpFac->kill(object);
+        return;
+      }
+      tmpFac = tmpFac->next;
+    }
+
+  }
+}
Index: /orxonox/trunk/src/util/fast_factory.h
===================================================================
--- /orxonox/trunk/src/util/fast_factory.h	(revision 4940)
+++ /orxonox/trunk/src/util/fast_factory.h	(revision 4940)
@@ -0,0 +1,174 @@
+/*!
+ * @file fast_factory.h
+ * The ObjectManager (FastFactory) is designed, to automatically generate and remove
+ * (without to much overhead) many instances of different classes.
+ *
+ * It is especially usefull for objects, that come only for a short time into existence,
+ * and get killed after a small amount of time (like shots).
+ *
+ * The Creation of an Object is usually done in the Weapon Class, where one subscribes
+ * a Projectile with:
+ * this->bulletFactory = tFastFactory<TestBullet>::getFastFactory(CL_TEST_BULLET, "TestBullet");
+ * (this might change over time).
+ * Then you can at loading time initialize an amount of the class with something like:
+ * this->bulletFactory->prepare(100); // creates 100 entities of TestBullet (dead ones)
+ * afterwards one can just retrieve an Object form the Class with
+ * this->bulletFactory->resurrect();  // this returns a BaseObject an Object of the class.
+ */
+
+
+#ifndef _FAST_FACTORY_H
+#define _FAST_FACTORY_H
+
+#include "base_object.h"
+
+
+// FORWARD DECLARATION //
+class GarbageCollector;
+template<class T>
+class tList;
+
+/**
+ * Creates a FastFactory to a Loadable FastFactory.
+ */
+//#define CREATE_FAST_FACTORY(CLASS_NAME, CLASS_ID) \
+//tFastFactory<CLASS_NAME>* global_##CLASS_NAME##_FastFactory = new tFastFactory<CLASS_NAME>(#CLASS_NAME, CLASS_ID)
+
+//! A struct, that holds Lists of Objects of a certain type.
+struct FastObjectMember
+  {
+    BaseObject*          objectPointer;      //!< Pointer to the Object Stored in this Class (if it is the DeadList, else it is bork)
+
+    FastObjectMember*    next;               //!< the next stored FastObjectMember. (or NULL if this is the last one stored in either the deadList or the unusedContainers)
+  };
+
+//! The FastFactory is a fast loadable object creator, and Dynamic List of dead object handler.
+/**
+ * The ObjectManager (FastFactory) is designed, to automatically generate and remove
+ * (without to much overhead) many instances of different classes.
+ *
+ * FastFactory is needed to glue all the tFastFactories together.
+ * It is also the general class that implements the necessary functions
+ * to generate, resurrect kill and stuff...
+ */
+class FastFactory : public BaseObject
+  {
+
+  public:
+    virtual ~FastFactory ();
+
+    // functions to push and pop elements of this class
+    BaseObject* resurrect();
+    static BaseObject* resurrect(ClassID classID);
+    void kill(BaseObject* object);
+    static void kill(BaseObject* object, bool searchForFastFactory);
+
+    void prepare(unsigned int count);
+    // retrival functions for fast Ineraction
+    //FastFactory* getFastFactory(ClassID classID);
+
+    static void flushAll(bool hardFLUSH = false);
+    void flush(bool hardFLUSH = false);
+
+    /** @returns the first FastFactory */
+    static FastFactory* getFirst()
+    {
+      return FastFactory::first;
+    };
+
+  protected:
+    FastFactory (ClassID classID, const char* fastFactoryName = NULL);
+
+    /** sets the Next factory in the list @param nextFactory the next factory */
+    inline void setNext( FastFactory* nextFastFactory)
+    {
+      this->next = nextFastFactory;
+    };
+    /** @returns the next FastFactory */
+    FastFactory* getNext() const
+      {
+        return this->next;
+      };
+
+    /** generates a new Object of the Class T */
+    virtual void fabricate() = NULL;
+    static FastFactory* searchFastFactory(ClassID classID, const char* fastFactoryName = NULL);
+
+  private:
+    static void registerFastFactory(FastFactory* fastFactory);
+
+  protected:
+    ClassID               storedClassID;        //!< The classID of the specified class.
+    unsigned int          storedDeadObjects;    //!< How many dead objects are stored in this class
+
+    FastObjectMember*     deadList;             //!< A List of all stored dead Objects of this class.
+    FastObjectMember*     unusedContainers;     //!< This is a List of unused containers, that will be reused by kill.
+
+  private:
+    static FastFactory*   first;                //!< A pointer to the first FastFactory.
+
+    FastFactory*          next;                 //!< pointer to the next FastFactory.
+  };
+
+/**
+ *  a FastFactory that is able to load any kind of Object from a ClassID
+ * (this is a Functor)
+ */
+template<class T>
+class tFastFactory : public FastFactory
+  {
+  public:
+    static tFastFactory<T>* getFastFactory(ClassID classID, const char* fastFactoryName = NULL);
+
+  private:
+    tFastFactory(ClassID classID, const char* fastFactoryName);
+
+    virtual void fabricate();
+  };
+
+/**
+ * construnts a FastFactory with
+ * @param fastFactoryName the name of the FastFactory
+ * @param fastFactory the ID of the class
+ * @todo (can this be written in another form??)
+ */
+template<class T>
+tFastFactory<T>::tFastFactory(ClassID classID, const char* fastFactoryName)
+    : FastFactory(classID, fastFactoryName)
+{}
+
+/**
+ * creates (if not existent) a Factory of Class T, and assigns some values to it
+ * @param classID the ClassID to assign to this class
+ * @param fastFactoryName the name to assign
+ * @returns The FastFactory if existent a new Factory if not.
+ */
+template<class T>
+tFastFactory<T>* tFastFactory<T>::getFastFactory(ClassID classID, const char* fastFactoryName)
+{
+  tFastFactory<T>* tmpFac = NULL;
+  if (FastFactory::getFirst() != NULL)
+    tmpFac = static_cast<tFastFactory<T>*>(FastFactory::getFirst()->searchFastFactory(classID, fastFactoryName));
+
+  if (tmpFac != NULL)
+    return tmpFac;
+  else
+    return new tFastFactory<T>(classID, fastFactoryName);
+}
+
+
+/**
+ * fabricates an Object of Class T, that corresponds to classID.
+ */
+template<class T>
+void tFastFactory<T>::fabricate()
+{
+  FastObjectMember* tmpFirstDead = new FastObjectMember;
+  tmpFirstDead->objectPointer = new T();
+  tmpFirstDead->next = this->deadList;
+  ++this->storedDeadObjects;
+
+  this->deadList = tmpFirstDead;
+}
+
+#endif /* _FAST_FACTORY_H */
Index: /orxonox/trunk/src/util/object_manager.cc
===================================================================
--- /orxonox/trunk/src/util/object_manager.cc	(revision 4939)
+++ /orxonox/trunk/src/util/object_manager.cc	(revision 4940)
@@ -9,5 +9,5 @@
    any later version.
 
-   ### File Specific:
+### File Specific:
    main-programmer: Patrick Boenzli
 */
@@ -22,239 +22,4 @@
 
 using namespace std;
-
-/**
- * Initializes a FastFactory
- * @param classID the ClassID this Class belongs to (the top-most)
- * @param fastFactoryName the Name of the ObjectClass-handled here
- * @return a new FastFactory
- */
-FastFactory::FastFactory (ClassID classID, const char* fastFactoryName)
-{
-  this->setClassID(CL_FAST_FACTORY, "FastFactory");
-  this->setName(fastFactoryName);
-
-  this->storedClassID = classID;
-  this->next = NULL;
-
-  this->deadList = NULL;
-  this->unusedContainers = NULL;
-
-  this->storedDeadObjects = 0;
-
-  FastFactory::registerFastFactory(this);
-}
-
-/** a reference to the First FastFactory */
-FastFactory* FastFactory::first = NULL;
-
-/**
- *  destructor
- * deletes all the Instances of the FastFactory.
- */
-FastFactory::~FastFactory ()
-{
-  if (this == first)
-    this->first = NULL;
-
-  if (this->next)
-    delete this->next;
-}
-
-/**
- * registers a Factory to the List of known factories.
- * @param fastFactory The factory to add
- *
- * needed, to step through all the FastFactories.
- */
-void FastFactory::registerFastFactory(FastFactory* fastFactory)
-{
-  PRINTF(4)("Registered FastFactory for '%s'\n", fastFactory->getName());
-
-  if( FastFactory::first == NULL)
-    FastFactory::first = fastFactory;
-  else
-  {
-    FastFactory* tmpFac = FastFactory::first;
-    while( tmpFac->next != NULL)
-      tmpFac = tmpFac->next;
-    tmpFac->setNext(fastFactory);
-  }
-}
-
-
-/**
- * searches for a FastFactory
- * @param factoryName the Name of the Factory to search for (not used)
- * @param classID the ClassID of the FastFactory to search for
- * @returns true if found, false otherwise.
- */
-FastFactory* FastFactory::searchFastFactory(ClassID classID, const char* fastFactoryName)
-{
-  if (FastFactory::first == NULL)
-    return NULL;
-   else
-   {
-     FastFactory* tmpFac = FastFactory::first;
-     while (tmpFac != NULL)
-     {
-       if (tmpFac->storedClassID == classID)
-         return tmpFac;
-       tmpFac = tmpFac->next;
-     }
-   }
-   return NULL;
-}
-
-/**
- * Removes all the stored Containers, and sets the Lists back to emptienes.
- * @param hardFLUSH if true the containing Objects will also be deleted !! THIS IS DANGEROUS !!
- */
-void FastFactory::flushAll(bool hardFLUSH)
-{
-  FastFactory* tmpFac = FastFactory::first;
-  while (tmpFac != NULL)
-  {
-    tmpFac->flush(hardFLUSH);
-    tmpFac = tmpFac->next;
-  }
-}
-
-
-/**
- * ereases all the remaining containers, without deleting the stored Objects inside of them.
- * @param hardFLUSH if the the containing Objects will also be deleted !! THIS IS DANGEROUS !!
- */
-void FastFactory::flush(bool hardFLUSH)
-{
-  FastObjectMember* tmpMember = this->deadList, *delMember = NULL;
-  while (tmpMember != NULL)
-  {
-    delMember = tmpMember;
-    tmpMember = tmpMember->next;
-    if (unlikely(hardFLUSH == true))
-      delete delMember->objectPointer;
-    delete delMember;
-  }
-  this->deadList = NULL;
-
-  tmpMember = this->unusedContainers;
-  while (tmpMember != NULL)
-  {
-    delMember = tmpMember;
-    tmpMember = tmpMember->next;
-    delete delMember;
-  }
-  this->unusedContainers = NULL;
-}
-
-/**
- * generates count new Object of the Corresponding class. (precaching)
- * @param count How many instances of the class should be generated.
- */
-void FastFactory::prepare(unsigned int count)
-{
-/*  if (this->storedDeadObjects + this->storedLivingObjects >= count)
-  {
-  PRINTF(3)("not creating new Objects for class %s, because the requested count already exists\n", this->getClassName());
-}*/
-  for (int i = this->storedDeadObjects; i < count; i++)
-  {
-    this->fabricate();
-  }
-}
-
-/**
- * gives back live to one Object.
- * @return the Object to resurrect.
- */
-BaseObject* FastFactory::resurrect()
-{
-  PRINTF(4)("Resurecting Object of type %s\n", this->getName());
-  if (unlikely(this->deadList == NULL))
-  {
-    PRINTF(2)("The deadList of Class %s is empty, this may be either because it has not been filled yet, or the cache is to small.\n" \
-        "Fabricating a new %s", this->getName(), this->getName());
-    this->fabricate();
-    return this->resurrect();
-  }
-  else
-  {
-  FastObjectMember* tmpC = deadList;
-  this->deadList = this->deadList->next;
-
-  tmpC->next = this->unusedContainers;
-  this->unusedContainers = tmpC;
-
-  return tmpC->objectPointer;
-  }
-}
-
-/**
- * gives back live to one Object.
- * @param classID the class From which to resurrect an Object.
- * @return the Object to resurrect, NULL if classID is not found.
- */
-BaseObject* FastFactory::resurrect(ClassID classID)
-{
-  FastFactory* tmpFac = FastFactory::getFirst();
-
-  while (tmpFac != NULL)
-  {
-    if (classID == tmpFac->storedClassID)
-      return tmpFac->resurrect();
-    tmpFac = tmpFac->next;
-  }
-  return NULL;
-}
-
-/**
- * kills Object object, meaning, that it will be stored in the deadList of the FastFactory, and waiting for resurrection
- * @param object the Object to kill.
- *
- * synony that would be really grate would be abolish, but this is more like exterminate than pause-mode.
- */
-void FastFactory::kill(BaseObject* object)
-{
-  FastObjectMember* tmpC;
-  if (unlikely(this->unusedContainers == NULL))
-  {
-    tmpC = new FastObjectMember;
-  }
-  else
-  {
-    tmpC = this->unusedContainers;
-    this->unusedContainers = this->unusedContainers->next;
-  }
-
-  tmpC->next = this->deadList;
-  tmpC->objectPointer = object;
-  this->deadList = tmpC;
-}
-
-
-void FastFactory::kill(BaseObject* object, bool searchForFastFactory)
-{
-  if (likely(searchForFastFactory == true))
-  {
-    FastFactory* tmpFac = FastFactory::first;
-    while (tmpFac != NULL)
-    {
-      if (object->isA(tmpFac->storedClassID))
-      {
-        tmpFac->kill(object);
-        return;
-      }
-      tmpFac = tmpFac->next;
-    }
-
-  }
-}
-
-
-
-
-
-
-
 
 /**
Index: /orxonox/trunk/src/util/object_manager.h
===================================================================
--- /orxonox/trunk/src/util/object_manager.h	(revision 4939)
+++ /orxonox/trunk/src/util/object_manager.h	(revision 4940)
@@ -1,20 +1,5 @@
 /*!
  * @file object_manager.h
- * The ObjectManager (FastFactory) is designed, to automatically generate and remove
- * (without to much overhead) many instances of different classes.
- *
- * It is especially usefull for objects, that come only for a short time into existence,
- * and get killed after a small amount of time (like shots).
- *
- * The Creation of an Object is usually done in the Weapon Class, where one subscribes
- * a Projectile with:
- * this->bulletFactory = tFastFactory<TestBullet>::getFastFactory(CL_TEST_BULLET, "TestBullet");
- * (this might change over time).
- * Then you can at loading time initialize an amount of the class with something like:
- * this->bulletFactory->prepare(100); // creates 100 entities of TestBullet (dead ones)
- * afterwards one can just retrieve an Object form the Class with
- * this->bulletFactory->resurrect();  // this returns a BaseObject an Object of the class.
-*/
-
+ */
 
 #ifndef _OBJECT_MANAGER_H
@@ -26,146 +11,6 @@
 // FORWARD DECLARATION //
 class GarbageCollector;
-template<class T> class tList;
-
-/**
- * Creates a FastFactory to a Loadable FastFactory.
- */
-//#define CREATE_FAST_FACTORY(CLASS_NAME, CLASS_ID) \
-    //tFastFactory<CLASS_NAME>* global_##CLASS_NAME##_FastFactory = new tFastFactory<CLASS_NAME>(#CLASS_NAME, CLASS_ID)
-
-//! A struct, that holds Lists of Objects of a certain type.
-struct FastObjectMember
-{
-  BaseObject*          objectPointer;      //!< Pointer to the Object Stored in this Class (if it is the DeadList, else it is bork)
-
-  FastObjectMember*    next;               //!< the next stored FastObjectMember. (or NULL if this is the last one stored in either the deadList or the unusedContainers)
-};
-
-//! The FastFactory is a fast loadable object creator, and Dynamic List of dead object handler.
-/**
- * The ObjectManager (FastFactory) is designed, to automatically generate and remove
- * (without to much overhead) many instances of different classes.
- *
- * FastFactory is needed to glue all the tFastFactory<T>'s together.
- * It is also the general class that implements the necessary functions
- * to generate, resurrect kill and stuff...
- */
-class FastFactory : public BaseObject {
-
-  public:
-    virtual ~FastFactory ();
-
-    // functions to push and pop elements of this class
-    BaseObject* resurrect();
-    static BaseObject* resurrect(ClassID classID);
-    void kill(BaseObject* object);
-    static void kill(BaseObject* object, bool searchForFastFactory);
-
-    void prepare(unsigned int count);
-    // retrival functions for fast Ineraction
-    //FastFactory* getFastFactory(ClassID classID);
-
-    static void flushAll(bool hardFLUSH = false);
-    void flush(bool hardFLUSH = false);
-
-    /** @returns the first FastFactory */
-    static FastFactory* getFirst() { return FastFactory::first; };
-
-  protected:
-    FastFactory (ClassID classID, const char* fastFactoryName = NULL);
-
-    /** sets the Next factory in the list @param nextFactory the next factory */
-    inline void setNext( FastFactory* nextFastFactory) { this->next = nextFastFactory; };
-    /** @returns the next FastFactory */
-    FastFactory* getNext() const { return this->next; };
-
-    /** generates a new Object of the Class T */
-    virtual void fabricate() = NULL;
-    static FastFactory* searchFastFactory(ClassID classID, const char* fastFactoryName = NULL);
-
-  private:
-    static void registerFastFactory(FastFactory* fastFactory);
-
-  protected:
-    ClassID               storedClassID;        //!< The classID of the specified class.
-    unsigned int          storedDeadObjects;    //!< How many dead objects are stored in this class
-
-    FastObjectMember*     deadList;             //!< A List of all stored dead Objects of this class.
-    FastObjectMember*     unusedContainers;     //!< This is a List of unused containers, that will be reused by kill.
-
-  private:
-    static FastFactory*   first;                //!< A pointer to the first FastFactory.
-
-    FastFactory*          next;                 //!< pointer to the next FastFactory.
-};
-
-/**
- *  a FastFactory that is able to load any kind of Object from a ClassID
- * (this is a Functor)
- */
-template<class T> class tFastFactory : public FastFactory
-{
-  public:
-    static tFastFactory<T>* getFastFactory(ClassID classID, const char* fastFactoryName = NULL);
-
-  private:
-    tFastFactory(ClassID classID, const char* fastFactoryName);
-
-    virtual void fabricate();
-};
-
-/**
- * construnts a FastFactory with
- * @param fastFactoryName the name of the FastFactory
- * @param fastFactory the ID of the class
- * @todo (can this be written in another form??)
- */
 template<class T>
-    tFastFactory<T>::tFastFactory(ClassID classID, const char* fastFactoryName)
-  : FastFactory(classID, fastFactoryName)
-{
-}
-
-/**
- * creates (if not existent) a Factory of Class T, and assigns some values to it
- * @param classID the ClassID to assign to this class
- * @param fastFactoryName the name to assign
- * @returns The FastFactory if existent a new Factory if not.
- */
-template<class T>
-    tFastFactory<T>* tFastFactory<T>::getFastFactory(ClassID classID, const char* fastFactoryName)
-{
-  tFastFactory<T>* tmpFac = NULL;
-  if (FastFactory::getFirst() != NULL)
-    tmpFac = static_cast<tFastFactory<T>*>(FastFactory::getFirst()->searchFastFactory(classID, fastFactoryName));
-
-  if (tmpFac != NULL)
-    return tmpFac;
-  else
-    return new tFastFactory<T>(classID, fastFactoryName);
-}
-
-
-/**
- * fabricates an Object of Class T, that corresponds to classID.
- */
-template<class T>
-    void tFastFactory<T>::fabricate()
-{
-  FastObjectMember* tmpFirstDead = new FastObjectMember;
-  tmpFirstDead->objectPointer = new T();
-  tmpFirstDead->next = this->deadList;
-  ++this->storedDeadObjects;
-
-  this->deadList = tmpFirstDead;
-}
-
-
-
-
-
-
-
-
+    class tList;
 
 ////////////////////
Index: /orxonox/trunk/src/world_entities/weapons/test_gun.cc
===================================================================
--- /orxonox/trunk/src/world_entities/weapons/test_gun.cc	(revision 4939)
+++ /orxonox/trunk/src/world_entities/weapons/test_gun.cc	(revision 4940)
@@ -33,5 +33,5 @@
 #include "sound_engine.h"
 
-#include "object_manager.h"
+#include "fast_factory.h"
 
 
