Index: orxonox/branches/levelLoader.tmp/src/Makefile.am
===================================================================
--- orxonox/branches/levelLoader.tmp/src/Makefile.am	(revision 3900)
+++ orxonox/branches/levelLoader.tmp/src/Makefile.am	(revision 3901)
@@ -20,4 +20,6 @@
 AM_CXXFLAGS+=-I$(MAINSRCDIR)/util/animation
 AM_CXXFLAGS+=-I$(MAINSRCDIR)/util/common
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/util/levelloader
+
 
 
@@ -77,8 +79,9 @@
 		 lib/xmlparser/tinyxmlparser.cc \
 		 util/common/list.cc \
+		 util/levelloader/factory.cc \
 		 util/resource_manager.cc \
 		 lib/math/vector.cc \
 		 lib/math/curve.cc \
-		 glmenu/glmenu_imagescreen.cc 
+		 glmenu/glmenu_imagescreen.cc  
 
 noinst_HEADERS = orxonox.h \
@@ -136,4 +139,5 @@
 		 util/common/list.h \
 		 util/common/list_template.h \
+		 utils/levelloader/factory.h \
 		 util/resource_manager.h \
 		 lib/util/ini_parser.h \
Index: orxonox/branches/levelLoader.tmp/src/Makefile.in
===================================================================
--- orxonox/branches/levelLoader.tmp/src/Makefile.in	(revision 3900)
+++ orxonox/branches/levelLoader.tmp/src/Makefile.in	(revision 3901)
@@ -71,6 +71,6 @@
 	ini_parser.$(OBJEXT) tinystr.$(OBJEXT) tinyxml.$(OBJEXT) \
 	tinyxmlerror.$(OBJEXT) tinyxmlparser.$(OBJEXT) list.$(OBJEXT) \
-	resource_manager.$(OBJEXT) vector.$(OBJEXT) curve.$(OBJEXT) \
-	glmenu_imagescreen.$(OBJEXT)
+	factory.$(OBJEXT) resource_manager.$(OBJEXT) vector.$(OBJEXT) \
+	curve.$(OBJEXT) glmenu_imagescreen.$(OBJEXT)
 orxonox_OBJECTS = $(am_orxonox_OBJECTS)
 orxonox_LDADD = $(LDADD)
@@ -87,5 +87,5 @@
 @AMDEP_TRUE@	./$(DEPDIR)/command_node.Po ./$(DEPDIR)/curve.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/data_tank.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/environment.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/environment.Po ./$(DEPDIR)/factory.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/game_loader.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/garbage_collector.Po \
@@ -242,5 +242,5 @@
 target_vendor = @target_vendor@
 MAINSRCDIR = .
-AM_CXXFLAGS = -I$(MAINSRCDIR) -I$(MAINSRCDIR)/world_entities -I$(MAINSRCDIR)/story_entities -I$(MAINSRCDIR)/lib -I$(MAINSRCDIR)/lib/coord -I$(MAINSRCDIR)/lib/data -I$(MAINSRCDIR)/lib/graphics -I$(MAINSRCDIR)/lib/graphics/importer -I$(MAINSRCDIR)/lib/gui -I$(MAINSRCDIR)/lib/lang -I$(MAINSRCDIR)/lib/util -I$(MAINSRCDIR)/lib/math -I$(MAINSRCDIR)/defs -I$(MAINSRCDIR)/font -I$(MAINSRCDIR)/network -I$(MAINSRCDIR)/glmenu -I$(MAINSRCDIR)/ai -I$(MAINSRCDIR)/util -I$(MAINSRCDIR)/util/animation -I$(MAINSRCDIR)/util/common
+AM_CXXFLAGS = -I$(MAINSRCDIR) -I$(MAINSRCDIR)/world_entities -I$(MAINSRCDIR)/story_entities -I$(MAINSRCDIR)/lib -I$(MAINSRCDIR)/lib/coord -I$(MAINSRCDIR)/lib/data -I$(MAINSRCDIR)/lib/graphics -I$(MAINSRCDIR)/lib/graphics/importer -I$(MAINSRCDIR)/lib/gui -I$(MAINSRCDIR)/lib/lang -I$(MAINSRCDIR)/lib/util -I$(MAINSRCDIR)/lib/math -I$(MAINSRCDIR)/defs -I$(MAINSRCDIR)/font -I$(MAINSRCDIR)/network -I$(MAINSRCDIR)/glmenu -I$(MAINSRCDIR)/ai -I$(MAINSRCDIR)/util -I$(MAINSRCDIR)/util/animation -I$(MAINSRCDIR)/util/common -I$(MAINSRCDIR)/util/levelloader
 AM_LDFLAGS = $(MWINDOWS)
 orxonox_SOURCES = orxonox.cc \
@@ -292,8 +292,9 @@
 		 lib/xmlparser/tinyxmlparser.cc \
 		 util/common/list.cc \
+		 util/levelloader/factory.cc \
 		 util/resource_manager.cc \
 		 lib/math/vector.cc \
 		 lib/math/curve.cc \
-		 glmenu/glmenu_imagescreen.cc 
+		 glmenu/glmenu_imagescreen.cc  
 
 noinst_HEADERS = orxonox.h \
@@ -351,4 +352,5 @@
 		 util/common/list.h \
 		 util/common/list_template.h \
+		 utils/levelloader/factory.h \
 		 util/resource_manager.h \
 		 lib/util/ini_parser.h \
@@ -450,4 +452,5 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data_tank.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/environment.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/factory.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/game_loader.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/garbage_collector.Po@am__quote@
@@ -1160,4 +1163,20 @@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o list.obj `if test -f 'util/common/list.cc'; then $(CYGPATH_W) 'util/common/list.cc'; else $(CYGPATH_W) '$(srcdir)/util/common/list.cc'; fi`
+
+factory.o: util/levelloader/factory.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT factory.o -MD -MP -MF "$(DEPDIR)/factory.Tpo" -c -o factory.o `test -f 'util/levelloader/factory.cc' || echo '$(srcdir)/'`util/levelloader/factory.cc; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/factory.Tpo" "$(DEPDIR)/factory.Po"; else rm -f "$(DEPDIR)/factory.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='util/levelloader/factory.cc' object='factory.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/factory.Po' tmpdepfile='$(DEPDIR)/factory.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o factory.o `test -f 'util/levelloader/factory.cc' || echo '$(srcdir)/'`util/levelloader/factory.cc
+
+factory.obj: util/levelloader/factory.cc
+@am__fastdepCXX_TRUE@	if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT factory.obj -MD -MP -MF "$(DEPDIR)/factory.Tpo" -c -o factory.obj `if test -f 'util/levelloader/factory.cc'; then $(CYGPATH_W) 'util/levelloader/factory.cc'; else $(CYGPATH_W) '$(srcdir)/util/levelloader/factory.cc'; fi`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/factory.Tpo" "$(DEPDIR)/factory.Po"; else rm -f "$(DEPDIR)/factory.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='util/levelloader/factory.cc' object='factory.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	depfile='$(DEPDIR)/factory.Po' tmpdepfile='$(DEPDIR)/factory.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o factory.obj `if test -f 'util/levelloader/factory.cc'; then $(CYGPATH_W) 'util/levelloader/factory.cc'; else $(CYGPATH_W) '$(srcdir)/util/levelloader/factory.cc'; fi`
 
 resource_manager.o: util/resource_manager.cc
@@ -1347,5 +1366,5 @@
 
 distdir: $(DISTFILES)
-	$(mkdir_p) $(distdir)/ai $(distdir)/defs $(distdir)/glmenu $(distdir)/lib/coord $(distdir)/lib/data $(distdir)/lib/graphics $(distdir)/lib/lang $(distdir)/lib/math $(distdir)/lib/util $(distdir)/lib/xmlparser $(distdir)/network $(distdir)/proto $(distdir)/story_entities $(distdir)/util $(distdir)/util/animation $(distdir)/util/common $(distdir)/world_entities
+	$(mkdir_p) $(distdir)/ai $(distdir)/defs $(distdir)/glmenu $(distdir)/lib/coord $(distdir)/lib/data $(distdir)/lib/graphics $(distdir)/lib/lang $(distdir)/lib/math $(distdir)/lib/util $(distdir)/lib/xmlparser $(distdir)/network $(distdir)/proto $(distdir)/story_entities $(distdir)/util $(distdir)/util/animation $(distdir)/util/common $(distdir)/utils/levelloader $(distdir)/world_entities
 	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
Index: orxonox/branches/levelLoader.tmp/src/defs/factory.h
===================================================================
--- orxonox/branches/levelLoader.tmp/src/defs/factory.h	(revision 3900)
+++ 	(revision )
@@ -1,25 +1,0 @@
-/*!
-  \file factory.h
-  \brief This File creates a class, that can load any Object
-*/
-
-#ifndef _FACTORY_H
-#define _FACTORY_H
-
-
-#define CREATE_FACTORY(x) \
-		class x ## Factory : public Factory { \
-		 public:	\
-		  x ## Factory (){setNext( NULL); setClassname( #x ); initialize();} \
-		  ~x ## Factory () {}; \
-		 private: \
-			BaseObject* fabricate( TiXmlElement* root) \
-			{ \
-				if(!strcmp(root->Value(), getClassname())) return new  x ( root); \
-				else if( getNext() != NULL) return getNext()->fabricate( root); \
-				else return NULL; \
-			} \
-		}; \
-		x ## Factory global_ ## x ## Factory;
-
-#endif /* _FACTORY_H */
Index: orxonox/branches/levelLoader.tmp/src/util/levelLoader/factory.cc
===================================================================
--- orxonox/branches/levelLoader.tmp/src/util/levelLoader/factory.cc	(revision 3901)
+++ orxonox/branches/levelLoader.tmp/src/util/levelLoader/factory.cc	(revision 3901)
@@ -0,0 +1,97 @@
+
+
+/* 
+   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: Christian Meyer
+   co-programmer: ...
+*/
+
+
+#include "factory.h"
+#include "game_loader.h"
+
+using namespace std;
+
+/*  --------------------------------------------------
+*		 Factory
+*   --------------------------------------------------
+*/
+
+/**
+   \brief constructor
+   
+   set everything to zero and define classname
+*/
+Factory::Factory ()
+{
+	classname = "NULL";
+	next = NULL;
+}
+
+/**
+   \brief destructor
+   
+   clear the Q
+*/
+Factory::~Factory ()
+{
+	if( next != NULL)	delete next;
+}
+
+
+/**
+   \brief generates the associated object from data
+*/
+BaseObject* Factory::fabricate( TiXmlElement* data)
+{
+	return NULL;
+}
+
+/**
+   \brief make this particular factory known to the LevelFactory
+*/
+void Factory::initialize()
+{
+	assert( classname != NULL);
+	GameLoader* gl = GameLoader::getInstance();
+	gl->registerFactory( this);
+}
+
+/**
+   \brief add a Factory to the Q
+*/
+void Factory::registerFactory( Factory* factory)
+{
+	if( next == NULL) setNext( factory);
+	else next->registerFactory( factory);
+}
+
+const char* grabParameter( TiXmlElement* root, const char* name)
+{
+	TiXmlElement* element;
+	TiXmlNode* node;
+	
+	assert( root != NULL);
+	assert( name != NULL);
+	
+	element = root->FirstChildElement( name);
+	if( element == NULL) return NULL;
+	
+	node = element->FirstChild();
+	while( node != NULL)
+	{
+		if( node->ToText()) return node->Value();
+		node = node->NextSibling();
+	}
+	return NULL;
+}
+
Index: orxonox/branches/levelLoader.tmp/src/util/levelLoader/factory.h
===================================================================
--- orxonox/branches/levelLoader.tmp/src/util/levelLoader/factory.h	(revision 3901)
+++ orxonox/branches/levelLoader.tmp/src/util/levelLoader/factory.h	(revision 3901)
@@ -0,0 +1,59 @@
+/*! 
+    \file factory.h
+    \brief philosophy stuff
+*/
+
+#ifndef _FACTORY_H
+#define _FACTORY_H
+
+
+/** creates a Subclass of Factory, that HOPEFULLY loads modules \todo check it for real */
+#define CREATE_FACTORY(x) \
+		class x ## Factory : public Factory { \
+		 public:	\
+		  x ## Factory (){setNext( NULL); setClassname( #x ); initialize();} \
+		  ~x ## Factory () {}; \
+		 private: \
+			BaseObject* fabricate( TiXmlElement* root) \
+			{ \
+				if(!strcmp(root->Value(), getClassname())) return new  x ( root); \
+				else if( getNext() != NULL) return getNext()->fabricate( root); \
+				else return NULL; \
+			} \
+		}; \
+		x ## Factory global_ ## x ## Factory;
+
+#include "stdincl.h"
+
+class BaseObject;
+
+//! The Factory is
+/**
+	Very philosophic description, huh?
+*/
+class Factory {
+
+ public:
+  Factory ();
+  ~Factory ();
+
+	virtual BaseObject* fabricate( TiXmlElement* root);
+	void initialize();
+  void registerFactory( Factory* factory);
+	void setClassname(char* name) {classname = name;}
+	char* getClassname() {return classname;};
+	void setNext( Factory* factory) {next = factory;}
+	Factory* getNext() {return next;}
+	
+ private:
+	char* classname;
+	
+  Factory* next;
+};
+
+// helper function
+
+const char* grabParameter( TiXmlElement* root, const char* name);
+
+#endif /* _FACTORY_H */
+
