Index: orxonox/branches/levelloader/Makefile.in
===================================================================
--- orxonox/branches/levelloader/Makefile.in	(revision 3529)
+++ orxonox/branches/levelloader/Makefile.in	(revision 3530)
@@ -1,3 +1,3 @@
-# Makefile.in generated by automake 1.8.5 from Makefile.am.
+# Makefile.in generated by automake 1.8.2 from Makefile.am.
 # @configure_input@
 
@@ -38,6 +38,6 @@
 	$(srcdir)/Makefile.in $(srcdir)/config.h.in \
 	$(srcdir)/doc/documentation.am $(top_srcdir)/configure AUTHORS \
-	COPYING ChangeLog INSTALL NEWS config.guess config.sub depcomp \
-	install-sh missing mkinstalldirs
+	COPYING ChangeLog INSTALL NEWS TODO config.guess config.sub \
+	depcomp install-sh missing mkinstalldirs
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -326,14 +326,12 @@
 	tags=; \
 	here=`pwd`; \
-	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	if (etags --etags-include --version) >/dev/null 2>&1; then \
 	  include_option=--etags-include; \
-	  empty_fix=.; \
 	else \
 	  include_option=--include; \
-	  empty_fix=; \
 	fi; \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
-	    test ! -f $$subdir/TAGS || \
+	    test -f $$subdir/TAGS && \
 	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
 	  fi; \
@@ -345,9 +343,7 @@
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
-	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
-	fi
+	test -z "$(ETAGS_ARGS)$$tags$$unique" \
+	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	     $$tags $$unique
 ctags: CTAGS
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
@@ -458,5 +454,5 @@
 	  uncompress -c $(distdir).tar.Z | $(AMTAR) xf - ;;\
 	*.shar.gz*) \
-	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | unshar ;;\
 	*.zip*) \
 	  unzip $(distdir).zip ;;\
@@ -481,5 +477,5 @@
 	  && chmod -R a-w "$$dc_install_base" \
 	  && ({ \
-	       (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+	       (cd ../.. && $(mkdir_p) "$$dc_destdir") \
 	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
 	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
Index: orxonox/branches/levelloader/aclocal.m4
===================================================================
--- orxonox/branches/levelloader/aclocal.m4	(revision 3529)
+++ orxonox/branches/levelloader/aclocal.m4	(revision 3530)
@@ -1,3 +1,3 @@
-# generated automatically by aclocal 1.8.5 -*- Autoconf -*-
+# generated automatically by aclocal 1.8.2 -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
@@ -41,5 +41,5 @@
 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-	 [AM_AUTOMAKE_VERSION([1.8.5])])
+	 [AM_AUTOMAKE_VERSION([1.8.2])])
 
 # AM_AUX_DIR_EXPAND
@@ -150,5 +150,5 @@
 fi])])
 
-# serial 7						-*- Autoconf -*-
+# serial 6						-*- Autoconf -*-
 
 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
@@ -237,7 +237,5 @@
     for i in 1 2 3 4 5 6; do
       echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
-      # Solaris 8's {/usr,}/bin/sh.
-      touch sub/conftst$i.h
+      : > sub/conftst$i.h
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
@@ -267,12 +265,7 @@
        ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
       # icc doesn't choke on unknown options, it will just issue warnings
-      # or remarks (even with -Werror).  So we grep stderr for any message
-      # that says an option was ignored or not supported.
-      # When given -MP, icc 7.0 and 7.1 complain thusly:
-      #   icc: Command line warning: ignoring option '-M'; no argument required
-      # The diagnosis changed in icc 8.0:
-      #   icc: Command line remark: option '-MP' not supported
-      if (grep 'ignoring option' conftest.err ||
-          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+      # (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored.
+      if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
         am_cv_$1_dependencies_compiler_type=$depmode
         break
@@ -320,5 +313,5 @@
 # Generate code to set up dependency tracking.   -*- Autoconf -*-
 
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -359,12 +352,12 @@
   # Extract the definition of DEP_FILES from the Makefile without
   # running `make'.
-  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
   test -z "$DEPDIR" && continue
   # When using ansi2knr, U may be empty or an underscore; expand it
-  U=`sed -n 's/^U = //p' < "$mf"`
+  U=`sed -n -e '/^U = / s///p' < "$mf"`
   test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
   # We invoke sed twice because it is the simplest approach to
   # changing $(DEPDIR) to its actual value in the expansion.
-  for file in `sed -n '
+  for file in `sed -n -e '
     /^DEP_FILES = .*\\\\$/ {
       s/^DEP_FILES = //
@@ -725,14 +718,6 @@
 # Do not use -m 0755 and let people choose whatever they expect by
 # setting umask.
-#
-# We cannot accept any implementation of `mkdir' that recognizes `-p'.
-# Some implementations (such as Solaris 8's) are not thread-safe: if a
-# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
-# concurrently, both version can detect that a/ is missing, but only
-# one can create it and the other will error out.  Consequently we
-# restrict ourselves to GNU make (using the --version option ensures
-# this.)
 AC_DEFUN([AM_PROG_MKDIR_P],
-[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+[if mkdir -p -- . 2>/dev/null; then
   # Keeping the `.' argument allows $(mkdir_p) to be used without
   # argument.  Indeed, we sometimes output rules like
@@ -747,5 +732,5 @@
   # directories to create, and then abort because `.' already
   # exists.
-  for d in ./-p ./--version;
+  for d in ./-p ./--;
   do
     test -d $d && rmdir $d
Index: orxonox/branches/levelloader/configure
===================================================================
--- orxonox/branches/levelloader/configure	(revision 3529)
+++ orxonox/branches/levelloader/configure	(revision 3530)
@@ -1599,5 +1599,5 @@
 fi
 
-if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+if mkdir -p -- . 2>/dev/null; then
   # Keeping the `.' argument allows $(mkdir_p) to be used without
   # argument.  Indeed, we sometimes output rules like
@@ -1612,5 +1612,5 @@
   # directories to create, and then abort because `.' already
   # exists.
-  for d in ./-p ./--version;
+  for d in ./-p ./--;
   do
     test -d $d && rmdir $d
@@ -2518,7 +2518,5 @@
     for i in 1 2 3 4 5 6; do
       echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
-      # Solaris 8's {/usr,}/bin/sh.
-      touch sub/conftst$i.h
+      : > sub/conftst$i.h
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
@@ -2548,12 +2546,7 @@
        ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
       # icc doesn't choke on unknown options, it will just issue warnings
-      # or remarks (even with -Werror).  So we grep stderr for any message
-      # that says an option was ignored or not supported.
-      # When given -MP, icc 7.0 and 7.1 complain thusly:
-      #   icc: Command line warning: ignoring option '-M'; no argument required
-      # The diagnosis changed in icc 8.0:
-      #   icc: Command line remark: option '-MP' not supported
-      if (grep 'ignoring option' conftest.err ||
-          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+      # (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored.
+      if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
         am_cv_CXX_dependencies_compiler_type=$depmode
         break
@@ -3356,7 +3349,5 @@
     for i in 1 2 3 4 5 6; do
       echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
-      # Solaris 8's {/usr,}/bin/sh.
-      touch sub/conftst$i.h
+      : > sub/conftst$i.h
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
@@ -3386,12 +3377,7 @@
        ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
       # icc doesn't choke on unknown options, it will just issue warnings
-      # or remarks (even with -Werror).  So we grep stderr for any message
-      # that says an option was ignored or not supported.
-      # When given -MP, icc 7.0 and 7.1 complain thusly:
-      #   icc: Command line warning: ignoring option '-M'; no argument required
-      # The diagnosis changed in icc 8.0:
-      #   icc: Command line remark: option '-MP' not supported
-      if (grep 'ignoring option' conftest.err ||
-          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+      # (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored.
+      if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
         am_cv_CC_dependencies_compiler_type=$depmode
         break
@@ -9573,12 +9559,12 @@
   # Extract the definition of DEP_FILES from the Makefile without
   # running `make'.
-  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
   test -z "$DEPDIR" && continue
   # When using ansi2knr, U may be empty or an underscore; expand it
-  U=`sed -n 's/^U = //p' < "$mf"`
+  U=`sed -n -e '/^U = / s///p' < "$mf"`
   test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
   # We invoke sed twice because it is the simplest approach to
   # changing $(DEPDIR) to its actual value in the expansion.
-  for file in `sed -n '
+  for file in `sed -n -e '
     /^DEP_FILES = .*\\\\$/ {
       s/^DEP_FILES = //
Index: orxonox/branches/levelloader/src/defs/debug.h
===================================================================
--- orxonox/branches/levelloader/src/defs/debug.h	(revision 3529)
+++ orxonox/branches/levelloader/src/defs/debug.h	(revision 3530)
@@ -22,4 +22,10 @@
 #define _DEBUG_H
 
+#if HAVE_CONFIG_H 
+#include <config.h> 
+#endif
+
+#include <stdio.h>
+
 #define NO              0
 #define ERR             1
@@ -28,19 +34,12 @@
 #define DEBUGING        4
 
-#if HAVE_CONFIG_H 
-#include <config.h> 
-#endif
-
-#include <stdio.h>
-
 ///////////////////////////////////////////////////
 /// PRINTF: prints with filename and linenumber ///
 ///////////////////////////////////////////////////
-
 #ifdef DEBUG
 extern int verbose;
 #define PRINTF(x) \
            PRINTF ## x
-
+           
 #if DEBUG >= ERR
 #define PRINTF1 \
@@ -92,5 +91,5 @@
 #define PRINT(x) \
   PRINT ## x
-
+  
 #if DEBUG >= ERR
 #define PRINT1	\
Index: orxonox/branches/levelloader/src/defs/error.h
===================================================================
--- orxonox/branches/levelloader/src/defs/error.h	(revision 3529)
+++ orxonox/branches/levelloader/src/defs/error.h	(revision 3530)
@@ -23,6 +23,6 @@
 
 
-#ifndef _ERROR_H
-#define _ERROR_H
+#ifndef _ORX_ERROR_H
+#define _ORX_ERROR_H
 
 // these are the two undefined error nr. Don't use them ...
@@ -54,5 +54,5 @@
 */
 
-typedef struct 
+typedef struct ErrorMessage
 {
   int code;
Index: orxonox/branches/levelloader/src/defs/stdincl.h
===================================================================
--- orxonox/branches/levelloader/src/defs/stdincl.h	(revision 3529)
+++ orxonox/branches/levelloader/src/defs/stdincl.h	(revision 3530)
@@ -8,5 +8,5 @@
 #ifndef _STDINCL_H
 #define _STDINCL_H
-
+		
 #define null 0   //!< null
 
@@ -22,4 +22,5 @@
 #endif
 
+#include <assert.h>
 #include <stdlib.h>
 #include <string.h>
@@ -27,4 +28,6 @@
 #include "glincl.h"
 
+#include "error.h"
+#include "debug.h"
 
 // MATH //
@@ -41,6 +44,18 @@
 #include "factory.h"
 
-#include "error.h"
-#include "debug.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 /* _STDINCL_H */
Index: orxonox/branches/levelloader/src/factory.cc
===================================================================
--- orxonox/branches/levelloader/src/factory.cc	(revision 3529)
+++ orxonox/branches/levelloader/src/factory.cc	(revision 3530)
@@ -18,4 +18,5 @@
 
 #include "factory.h"
+#include "game_loader.h"
 
 using namespace std;
@@ -33,10 +34,10 @@
 Factory::Factory ()
 {
-	classname = "NULL"
+	classname = "NULL";
 	next = NULL;
 }
 
 /**
-   \brief constructor
+   \brief destructor
    
    clear the Q
@@ -51,5 +52,5 @@
    \brief generates the associated object from data
 */
-BaseObject* ObjectFactory::fabricate( TiXmlElement* data)
+BaseObject* Factory::fabricate( TiXmlElement* data)
 {
 	return NULL;
@@ -61,4 +62,6 @@
 void Factory::initialize()
 {
+	assert( classname != NULL);
+	PRINTF(3)("Initializing %sFactory\n", classname);
 	GameLoader* gl = GameLoader::getInstance();
 	gl->registerFactory( this);
@@ -88,6 +91,6 @@
 	while( node != NULL)
 	{
-		if( node->Type() == TEXT) return node->Value();
-		node = node->NextChild();
+		if( node->ToText()) return node->Value();
+		node = node->NextSibling();
 	}
 	return NULL;
Index: orxonox/branches/levelloader/src/factory.h
===================================================================
--- orxonox/branches/levelloader/src/factory.h	(revision 3529)
+++ orxonox/branches/levelloader/src/factory.h	(revision 3530)
@@ -8,19 +8,6 @@
 
 #include "stdincl.h"
-#include "world.h"
 
-#define CREATE_FACTORY(CLASS) class CLASSFactory : public Factory { \
- public:	\
-  CLASSFactory (){setNext( NULL); setClassname = "CLASS"; initialize();} \
-  ~CLASSFactory (); \
- private: \
-	BaseObject* fabricate( TiXmlElement* root) \
-	{ \
-		if(!strcmp(root->Value(), getClassname())) return new CLASS( root); \
-		else if( next != NULL) return next->fabricate( root); \
-		else return NULL; \
-	} \
-}; \
-CLASSFactory global_CLASSFactory;
+class BaseObject;
 
 //! The Factory is
@@ -37,7 +24,8 @@
 	void initialize();
   void registerFactory( Factory* factory);
-	void setClassname(char* name) {classname = name};
-	char* getClassname() {return classname};
-	void setNext( ObjectFactory* factory) {next = factory};
+	void setClassname(char* name) {classname = name;}
+	char* getClassname() {return classname;};
+	void setNext( Factory* factory) {next = factory;}
+	Factory* getNext() {return next;}
 	
  private:
Index: orxonox/branches/levelloader/src/game_loader.cc
===================================================================
--- orxonox/branches/levelloader/src/game_loader.cc	(revision 3529)
+++ orxonox/branches/levelloader/src/game_loader.cc	(revision 3530)
@@ -15,5 +15,4 @@
    co-programmer: ...
 */
-
 
 #include "game_loader.h"
@@ -162,5 +161,5 @@
   if( name == NULL)
   {
-		PRINTF(ERR)("No filename specified for loading");
+		PRINTF(1)("No filename specified for loading");
 		return NULL;
   }
@@ -168,8 +167,8 @@
 	TiXmlDocument* XMLDoc = new TiXmlDocument( name);
 	// load the campaign document
-	if( !XMLDoc.LoadFile())
+	if( !XMLDoc->LoadFile())
 	{
 		// report an error
-		PRINTF(ERR)("Error loading XML File: %s @ %d:%d\n", XMLDoc.ErrorDesc(), XMLDoc.ErrorRow(), XMLDoc.ErrorCol());
+		PRINTF(1)("Error loading XML File: %s @ %d:%d\n", XMLDoc->ErrorDesc(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
 		delete XMLDoc;
 		return NULL;
@@ -177,5 +176,5 @@
 	
 	// check basic validity
-	TiXmlElement* element = XMLDoc.RootElement();
+	TiXmlElement* element = XMLDoc->RootElement();
 	assert( element != NULL);
 	
@@ -185,5 +184,5 @@
 	{
 		// report an error
-		PRINTF(ERR)("Specified XML File is not an orxonox campaign file (Campaign element missing)\n");
+		PRINTF(1)("Specified XML File is not an orxonox campaign file (Campaign element missing)\n");
 		delete XMLDoc;
 		return NULL;
@@ -191,8 +190,10 @@
 	
 	// construct campaign
-	Campaign c = new Campaign( element);
+	Campaign* c = new Campaign( element);
 	
 	// free the XML data
 	delete XMLDoc;
+	
+	return c;
 }
 
@@ -269,6 +270,10 @@
 void GameLoader::registerFactory( Factory* factory)
 {
-	if( next == NULL) next = factory;
-	else next->registerFactory( factory);
+	assert( factory != NULL);
+	
+	printf("Registered factory for '%s'\n", factory->getClassname());
+	
+	if( first == NULL) first = factory;
+	else first->registerFactory( factory);
 }
 
@@ -277,9 +282,9 @@
    \param element a XMLElement containing all the needed info
 */
-StoryEntity* GameLoader::fabricate( TiXmlElement* element)
+BaseObject* GameLoader::fabricate( TiXmlElement* element)
 {
 	if( first == NULL)
 	{
-		PRINTF(ERR)("GameLoader does not know any factories, fabricate() failed\n");
+		PRINTF(1)("GameLoader does not know any factories, fabricate() failed\n");
 		return NULL;
 	}
Index: orxonox/branches/levelloader/src/game_loader.h
===================================================================
--- orxonox/branches/levelloader/src/game_loader.h	(revision 3529)
+++ orxonox/branches/levelloader/src/game_loader.h	(revision 3530)
@@ -4,4 +4,5 @@
 #include "stdincl.h"
 #include "story_def.h"
+#include "factory.h"
 
 //-----------------------------------------------------------------------------
Index: orxonox/branches/levelloader/src/lib/util/substring.cc
===================================================================
--- orxonox/branches/levelloader/src/lib/util/substring.cc	(revision 3529)
+++ orxonox/branches/levelloader/src/lib/util/substring.cc	(revision 3530)
@@ -22,5 +22,5 @@
 #include "substring.h"
 
-SubString::SubString( char* string)
+SubString::SubString( const char* string)
 {
 	n = 0;
@@ -32,15 +32,15 @@
 	n += 1;
 	
-	strings = malloc( sizeof( char*) * n);
+	strings = new char*[n];
 	
 	int i = 0;
 	int l = 0;
 	
-	char* offset = string;
+	const char* offset = string;
 	char* end = strchr( string, ',');
 	while( end != NULL)
 	{
 		l = end - offset;
-		strings[i] = malloc( l + 1);
+		strings[i] = new char[l + 1];
 		strncpy( strings[i], offset, l);
 		i++;
@@ -50,5 +50,5 @@
 	}
 	
-	strings[i] = malloc( l + 1);
+	strings[i] = new char[l + 1];
 	strncpy( strings[i], offset, l);
 	l = strlen( offset);
@@ -62,8 +62,8 @@
 	for( int i = 0; i < n; i++)
 	{
-		free( strings[i]);
+		delete strings[i];
 	}
 	
-	free( strings);
+	delete strings;
 }
 
Index: orxonox/branches/levelloader/src/lib/util/substring.h
===================================================================
--- orxonox/branches/levelloader/src/lib/util/substring.h	(revision 3529)
+++ orxonox/branches/levelloader/src/lib/util/substring.h	(revision 3530)
@@ -3,4 +3,7 @@
     \brief a small class to get the parts of a string separated by commas
 */
+
+#ifndef _SUBSTRING_H
+#define _SUBSTRING_H
 
 #include "stdincl.h"
@@ -10,5 +13,5 @@
 	public:
 	
-		SubString( char* string);
+		SubString( const char* string);
 		~SubString();
 		
@@ -20,2 +23,4 @@
 		int n;
 };
+
+#endif /* _SUBSTRING_H */
Index: orxonox/branches/levelloader/src/story_entities/campaign.cc
===================================================================
--- orxonox/branches/levelloader/src/story_entities/campaign.cc	(revision 3529)
+++ orxonox/branches/levelloader/src/story_entities/campaign.cc	(revision 3530)
@@ -22,7 +22,9 @@
 #include "story_entity.h"
 #include "factory.h"
+#include "game_loader.h"
 
 using namespace std;
 
+CREATE_FACTORY(Campaign);
 
 Campaign::Campaign () 
@@ -37,5 +39,5 @@
 {
 	TiXmlElement* element;
-	char string;
+	const char* string;
 	int id;
 	
@@ -48,10 +50,10 @@
   // grab all the necessary parameters
 	string = grabParameter( root, "identifier");
-	if( string == NULL || if( sscanf(string, "%d", &id) != 1))
-	{
-		PRINTF(ERR)("Campaign is missing a proper 'identifier'\n");
-		setStoryId( -1);
-	}
-	else setStoryId( id);
+	if( string == NULL || sscanf(string, "%d", &id) != 1)
+	{
+		PRINTF(1)("Campaign is missing a proper 'identifier'\n");
+		this->setStoryID( -1);
+	}
+	else this->setStoryID( id);
   	
   // find WorldList
@@ -63,5 +65,5 @@
 		StoryEntity* created = (StoryEntity*) loader->fabricate( element);
 		if( created != NULL) addEntity( created);
-		element = element->nextSiblingElement();
+		element = element->NextSiblingElement();
 	}
 }
Index: orxonox/branches/levelloader/src/story_entities/campaign.h
===================================================================
--- orxonox/branches/levelloader/src/story_entities/campaign.h	(revision 3529)
+++ orxonox/branches/levelloader/src/story_entities/campaign.h	(revision 3530)
@@ -41,5 +41,3 @@
 };
 
-CREATE_FACTORY(Campaign);
-
 #endif /* _CAMPAIGN_H */
Index: orxonox/branches/levelloader/src/story_entities/world.cc
===================================================================
--- orxonox/branches/levelloader/src/story_entities/world.cc	(revision 3529)
+++ orxonox/branches/levelloader/src/story_entities/world.cc	(revision 3530)
@@ -30,21 +30,24 @@
 #include "fontset.h"
 #include "factory.h"
+#include "game_loader.h"
 
 using namespace std;
 
+CREATE_FACTORY(World);
 
 World::World( TiXmlElement* root)
 {
-	char *string, *name;
+	const char *string;
+	char *name;
 	int id;
 
 	// identifier
 	string = grabParameter( root, "identifier");
-	if( string == NULL || if( sscanf(string, "%d", &id) != 1))
-	{
-		PRINTF(ERR)("World is missing a proper 'identifier'\n");
-		setStoryId( -1);
-	}
-	else setStoryId( id);
+	if( string == NULL || sscanf(string, "%d", &id) != 1)
+	{
+		PRINTF(1)("World is missing a proper 'identifier'\n");
+		this->setStoryID( -1);
+	}
+	else setStoryID( id);
 	
 	// path
@@ -52,6 +55,6 @@
 	if( string == NULL)
 	{
-		PRINTF(ERR)("World is missing a proper 'path'\n");
-		setPath( NULL);
+		PRINTF(1)("World is missing a proper 'path'\n");
+		this->setPath( NULL);
 	}
 	else
@@ -59,5 +62,5 @@
 		name = new char[strlen(string + 2)];
 		strcpy( name, string);
-		setPath( name);
+		this->setPath( name);
 	}
 	
@@ -105,4 +108,6 @@
   this->nullParent->destroy();  
   delete this->skySphere;
+  if( this->worldName) delete this->worldName;
+  if( this->path) delete this->path;
 
   //delete this->trackManager;
@@ -137,14 +142,14 @@
   if( getPath() == NULL)
   {
-		PRINTF(ERR)("World has no path specified for loading");
+		PRINTF(1)("World has no path specified for loading");
 		return (ErrorMessage){213,"Path not specified","World::load()"};
   }
   
-	TiXmlDocument* XMLDoc = new TiXmlDocument( name);
+	TiXmlDocument* XMLDoc = new TiXmlDocument( path);
 	// load the campaign document
-	if( !XMLDoc.LoadFile())
+	if( !XMLDoc->LoadFile())
 	{
 		// report an error
-		PRINTF(ERR)("Error loading XML File: %s @ %d:%d\n", XMLDoc.ErrorDesc(), XMLDoc.ErrorRow(), XMLDoc.ErrorCol());
+		PRINTF(1)("Error loading XML File: %s @ %d:%d\n", XMLDoc->ErrorDesc(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
 		delete XMLDoc;
 		return (ErrorMessage){213,"XML File parsing error","World::load()"};
@@ -152,13 +157,13 @@
 	
 	// check basic validity
-	TiXmlElement* root = XMLDoc.RootElement();
+	TiXmlElement* root = XMLDoc->RootElement();
 	assert( root != NULL);
 	
-	element = root->FirstChildElement( "WorldDataFile");
+	TiXmlElement* element = root->FirstChildElement( "WorldDataFile");
 	
 	if( root == NULL )
 	{
 		// report an error
-		PRINTF(ERR)("Specified XML File is not an orxonox world data file (WorldDataFile element missing)\n");
+		PRINTF(1)("Specified XML File is not an orxonox world data file (WorldDataFile element missing)\n");
 		delete XMLDoc;
 		return (ErrorMessage){213,"Path not a WorldDataFile","World::load()"};
@@ -167,16 +172,15 @@
 	// load the parameters
 		// name
-	TiXmlElement* element;
 	char* temp;
-	char* string = grabParameter( root, "name");
+	const char* string = grabParameter( root, "name");
 	if( string == NULL)
 	{
-		PRINTF(ERR)("World is missing a proper 'name'\n");
-		setStoryId( -1);
+		PRINTF(1)("World is missing a proper 'name'\n");
+		this->setStoryID( -1);
 	}
 	else
 	{
 		temp = new char[strlen(string + 2)];
-		worldName = temp;
+		this->worldName = temp;
 	}
 	
@@ -187,5 +191,5 @@
   if( element == NULL)
   {
-		PRINTF(ERR)("World is missing 'WorldEntities'\n");
+		PRINTF(1)("World is missing 'WorldEntities'\n");
   }
   else
@@ -197,5 +201,5 @@
 			WorldEntity* created = (WorldEntity*) loader->fabricate( element);
 			if( created != NULL) spawn( created);
-			element = element->nextSiblingElement();
+			element = element->NextSiblingElement();
 		}
 	}
@@ -205,5 +209,5 @@
   if( element == NULL)
   {
-		PRINTF(ERR)("World is missing a 'Track'\n");
+		PRINTF(1)("World is missing a 'Track'\n");
   }
   else
@@ -225,68 +229,4 @@
       testFont->buildFont("../data/pictures/font.tga");
 
-      // initializing the TrackManager
-      trackManager = TrackManager::getInstance();
-      trackManager->addPoint(Vector(0,-5,0));
-      trackManager->addPoint(Vector(10,0,5));
-      trackManager->addPoint(Vector(20,0,-5));
-      trackManager->addPoint(Vector(30,0,5));
-      trackManager->addPoint(Vector(40,0,5));
-      trackManager->setDuration(2);
-      trackManager->setSavePoint();
-      trackManager->addPoint(Vector(50,10,10));
-      trackManager->addPoint(Vector(60,0, 10));
-      trackManager->addPoint(Vector(70,0, 10));
-      trackManager->addPoint(Vector(80,0,-10));
-      trackManager->addPoint(Vector(90,0,-10));
-      trackManager->setDuration(5);
-      trackManager->setSavePoint();
-      trackManager->addPoint(Vector(110,0,5));
-      trackManager->addPoint(Vector(120,0, 10));
-      trackManager->addPoint(Vector(130,0, 10));
-      trackManager->addPoint(Vector(140,0,-10));
-      trackManager->addPoint(Vector(150,0,-10));
-      trackManager->setDuration(3);
-      int fork11, fork12, fork13, fork14;
-      trackManager->fork(4, &fork11, &fork12, &fork13, &fork14);
-      trackManager->workOn(fork11);
-      trackManager->addPoint(Vector(170, 0, -15));
-      trackManager->addPoint(Vector(180, 0, -15));
-      trackManager->setDuration(3);
-      trackManager->workOn(fork12);
-      trackManager->addPoint(Vector(170, 0, 10));
-      trackManager->addPoint(Vector(180, 0, 10));
-      trackManager->addPoint(Vector(190,2,5));
-      trackManager->addPoint(Vector(200,2,5));
-      trackManager->setDuration(7);
-      int fork21, fork22;
-      trackManager->fork(2, &fork21, &fork22);
-      trackManager->workOn(fork21);
-      trackManager->addPoint(Vector(220, 10,-10));
-      trackManager->addPoint(Vector(230, 0,-10));
-      trackManager->addPoint(Vector(240, 0, 2));
-      trackManager->addPoint(Vector(250, 0, 0));
-      trackManager->addPoint(Vector(260, 0, 5));
-      trackManager->setDuration(3);
-      trackManager->join(2, fork12, fork11);
-      trackManager->workOn(fork22);
-      trackManager->addPoint(Vector(220, -10,10));
-      trackManager->addPoint(Vector(230, 0, 10));
-      trackManager->addPoint(Vector(240, 0, 10));
-      trackManager->addPoint(Vector(250, 0, 5));
-      trackManager->setDuration(6);
-      trackManager->workOn(fork13);
-      trackManager->addPoint(Vector(200,-10,5));
-      trackManager->addPoint(Vector(250,-10,5));
-      trackManager->setDuration(3);
-      trackManager->workOn(fork14);
-      trackManager->addPoint(Vector(200,15,0));
-      trackManager->addPoint(Vector(210,0,10));
-      trackManager->setDuration(1);
-      trackManager->join(4, fork21, fork22, fork13, fork14);
-      trackManager->workOn(10);
-      trackManager->addPoint(Vector(250,-10,5));
-      trackManager->addPoint(Vector(260,-10,5));
-      trackManager->finalize();
-      
       /*monitor progress*/
       this->glmis->step();
Index: orxonox/branches/levelloader/src/story_entities/world.h
===================================================================
--- orxonox/branches/levelloader/src/story_entities/world.h	(revision 3529)
+++ orxonox/branches/levelloader/src/story_entities/world.h	(revision 3530)
@@ -8,6 +8,6 @@
 
 #include "stdincl.h"
+
 #include "story_entity.h"
-
 
 class TrackManager;
@@ -25,8 +25,11 @@
    it is the main driving factor during gameplay.
 */
+//#define SUBCLASS(x,y) class x : public y {
+
+//SUBCLASS(World,StoryEntity)
 class World : public StoryEntity {
 
  public:
- 	World (TiXmlElement* root),
+ 	World (TiXmlElement* root);
   World (char* name);
   World (int worldID);
@@ -92,5 +95,3 @@
 };
 
-CREATE_FACTORY(World);
-
 #endif /* _WORLD_H */
Index: orxonox/branches/levelloader/src/track_manager.cc
===================================================================
--- orxonox/branches/levelloader/src/track_manager.cc	(revision 3529)
+++ orxonox/branches/levelloader/src/track_manager.cc	(revision 3530)
@@ -112,5 +112,5 @@
 {
   // return if Found.
-  if ( this->name != NULL && !strcmp( this->name, trackname))
+  if ( this->name != NULL && !strcmp( this->name, trackName))
     return this;
   // search on.
@@ -160,5 +160,5 @@
   PRINTF(3)("Deleting all the TrackElements\n");
   delete this->firstTrackElem;
-  delete this->namer;
+  // delete this->name;
 
   // we do not have a TrackManager anymore
@@ -196,5 +196,5 @@
 	    	if( this->findTrackElementByName( names->getString(i)))
 	    	{
-	    		PRINTF(ERR)("Track name '%s' already taken
+	    		PRINTF(1)("Track name '%s' already taken", names->getString(i));
 	    	}
 	    }
@@ -699,8 +699,8 @@
 	while( element != NULL)
 	{
-		if( !strcmp( element->Value(), "Point")
+		if( !strcmp( element->Value(), "Point"))
 		{
 			container = element->FirstChild();
-			if( container != NULL && container->Type() == TEXT)
+			if( container->ToText())
 			{
 				assert( container->Value() != NULL);
@@ -709,12 +709,12 @@
 				else
 				{
-					PRINTF(ERR)("Invalid Point in Track (skipped)\n");
+					PRINTF(1)("Invalid Point in Track (skipped)\n");
 				}			
 			}
 		}
-		else if( !strcmp( element->Value(), "Duration")
+		else if( !strcmp( element->Value(), "Duration"))
 		{
 			container = element->FirstChild();
-			if( container != NULL && container->Type() == TEXT)
+			if( container->ToText())
 			{
 				assert( container->Value() != NULL);
@@ -723,16 +723,16 @@
 				else
 				{
-					PRINTF(ERR)("Invalid Duration in Track (skipped)\n");
+					PRINTF(1)("Invalid Duration in Track (skipped)\n");
 				}			
 			}
 		}
-		else if( !strcmp( element->Value(), "SavePoint")
+		else if( !strcmp( element->Value(), "SavePoint"))
 		{
 			setSavePoint();
 		}
-		else if( !strcmp( element->Value(), "Fork")
+		else if( !strcmp( element->Value(), "Fork"))
 		{
 			container = element->FirstChild();
-			if( container != NULL && container->Type() == TEXT)
+			if( container->ToText())
 			{
 				assert( container->Value() != NULL);
@@ -740,8 +740,8 @@
 			}
 		}
-		else if( !strcmp( element->Value(), "Join")
+		else if( !strcmp( element->Value(), "Join"))
 		{
 			container = element->FirstChild();
-			if( container != NULL && container->Type() == TEXT)
+			if( container->ToText())
 			{
 				assert( container->Value() != NULL);
@@ -749,8 +749,8 @@
 			}
 		}
-		else if( !strcmp( element->Value(), "WorkOn")
+		else if( !strcmp( element->Value(), "WorkOn"))
 		{
 			container = element->FirstChild();
-			if( container != NULL && container->Type() == TEXT)
+			if( container->ToText())
 			{
 				assert( container->Value() != NULL);
@@ -769,8 +769,8 @@
    The names used have to be unique within a particular track system.
 */
-void TrackManager::forkS( char* string)
+void TrackManager::forkS( const char* string)
 {
 	// get the names for the tracks and therefore the amount of new tracks
- 	SubString* names = new SubString( string);
+ 	SubString* parts = new SubString( string);
 	int *IDs;
 	int n = parts->getN();
@@ -780,9 +780,9 @@
 	IDs = new int[n];
 	
-	forkV( n, IDs, names);
+	forkV( n, IDs, parts);
 	
 	// IDs are irrelevant when assigning string names to tracks
 	delete IDs;
-	delete names;
+	delete parts;
 }
 
@@ -791,5 +791,5 @@
    \param string the names of the track to be joined, separated by commas
 */
-void TrackManager::joinS( char* string)
+void TrackManager::joinS( const char* string)
 {
 	SubString* parts = new SubString( string);
@@ -805,5 +805,5 @@
 	t = n;
 	
-	PRINTF(DEBUG)("Joining tracks:");
+	PRINTF(4)("Joining tracks:");
 	
 	for( int i = 0; i < n; i++)
@@ -812,10 +812,10 @@
 		if( element == NULL)
 		{
-			PRINTF(ERR)("Track name '%s' unknown, could not join\n", parts->getString( i));
+			PRINTF(1)("Track name '%s' unknown, could not join\n", parts->getString( i));
 			t--;
 		}
 		else
 		{
-			PRINTF(DEBUG)(" '%s'(%d)", parts->getString( i), element->ID);
+			PRINTF(4)(" '%s'(%d)", parts->getString( i), element->ID);
 			IDs[d] = element->ID;
 			d++;
@@ -823,5 +823,5 @@
 	}
 	
-	PRINTF(DEBUG)("\n");
+	PRINTF(4)("\n");
 
 	joinV( t, IDs);
@@ -835,5 +835,5 @@
    \param string the name of the track to work on (must have been previosly set by forkS)
 */
-void TrackManager::workOnS( char* string)
+void TrackManager::workOnS( const char* string)
 {
   TrackElement* tmpElem = findTrackElementByName( string);
@@ -841,5 +841,5 @@
     this->currentTrackElem = tmpElem;
   else
-    PRINTF(ERR)("TrackElement not Found, leaving unchanged\n");
-  PRINTF(DEBUG)("now Working on %d\n", this->currentTrackElem->ID);
-}
+    PRINTF(1)("TrackElement not Found, leaving unchanged\n");
+  PRINTF(4)("now Working on %d\n", this->currentTrackElem->ID);
+}
Index: orxonox/branches/levelloader/src/track_manager.h
===================================================================
--- orxonox/branches/levelloader/src/track_manager.h	(revision 3529)
+++ orxonox/branches/levelloader/src/track_manager.h	(revision 3530)
@@ -14,4 +14,5 @@
 #include "stdincl.h"
 #include "curve.h"
+#include "substring.h"
 
 class PNode;
@@ -38,5 +39,6 @@
   TrackElement* findByID(unsigned int trackID);
   TrackElement* findByName(const char* trackName);
-
+	void setName( const char* trackName);
+	
   bool isFresh;              //!< If no Points where added until now
   bool isHotPoint;           //!< If the first node is a specialPoint;
@@ -112,5 +114,5 @@
 
   TrackElement* findTrackElementByID(unsigned int trackID) const;
-  TrackElement* findTrackElementByName(char* trackName) const;
+  TrackElement* findTrackElementByName(const char* trackName) const;
   
  public:
@@ -133,7 +135,7 @@
   void joinV(unsigned int count, int* trackIDs);
   void finalize(void);
-	void forkS( char* string);
-	void joinS( char* string);
-	void workOnS( char* string);
+	void forkS( const char* string);
+	void joinS( const char* string);
+	void workOnS( const char* string);
 
 	// Method to load track data from file
