Index: branches/new_class_id/src/lib/event/key_mapper.cc
===================================================================
--- branches/new_class_id/src/lib/event/key_mapper.cc	(revision 9855)
+++ branches/new_class_id/src/lib/event/key_mapper.cc	(revision 9856)
@@ -25,5 +25,5 @@
 #include "globals.h"
 #include "parser/ini_parser/ini_parser.h"
-#include "util/preferences.h"
+#include "parser/preferences/preferences.h"
 #include "key_names.h"
 #include "event_def.h"
Index: branches/new_class_id/src/lib/graphics/graphics_engine.cc
===================================================================
--- branches/new_class_id/src/lib/graphics/graphics_engine.cc	(revision 9855)
+++ branches/new_class_id/src/lib/graphics/graphics_engine.cc	(revision 9856)
@@ -27,5 +27,5 @@
 #include "debug.h"
 
-#include "util/preferences.h"
+#include "parser/preferences/preferences.h"
 #include "substring.h"
 #include "text.h"
Index: branches/new_class_id/src/lib/gui/gui.cc
===================================================================
--- branches/new_class_id/src/lib/gui/gui.cc	(revision 9855)
+++ branches/new_class_id/src/lib/gui/gui.cc	(revision 9856)
@@ -18,5 +18,5 @@
 #include "gui.h"
 #include "gui_saveable.h"
-#include "preferences.h"
+#include "parser/preferences/preferences.h"
 
 namespace OrxGui
Index: branches/new_class_id/src/lib/gui/gui_saveable.cc
===================================================================
--- branches/new_class_id/src/lib/gui/gui_saveable.cc	(revision 9855)
+++ branches/new_class_id/src/lib/gui/gui_saveable.cc	(revision 9856)
@@ -18,5 +18,5 @@
 #include "gui_saveable.h"
 #include "gui.h"
-#include "preferences.h"
+#include "parser/preferences/preferences.h"
 
 #include "debug.h"
Index: branches/new_class_id/src/lib/network/network_game_manager.cc
===================================================================
--- branches/new_class_id/src/lib/network/network_game_manager.cc	(revision 9855)
+++ branches/new_class_id/src/lib/network/network_game_manager.cc	(revision 9856)
@@ -42,5 +42,5 @@
 #include "multiplayer_team_deathmatch.h"
 
-#include "preferences.h"
+#include "parser/preferences/preferences.h"
 
 
Index: branches/new_class_id/src/lib/network/network_log.cc
===================================================================
--- branches/new_class_id/src/lib/network/network_log.cc	(revision 9855)
+++ branches/new_class_id/src/lib/network/network_log.cc	(revision 9856)
@@ -15,4 +15,5 @@
 
 #include "network_log.h"
+#include <cassert>
 
 /**
@@ -53,11 +54,11 @@
     return false;
   }
-  
+
   listensock = SDLNet_TCP_Open( &ip );
-  
+
   if( !listensock ) {
     PRINT(1)( "SDLNet_TCP_Open: %s\n", SDLNet_GetError() );
     return false;
-  } 
+  }
 
   return true;
@@ -71,9 +72,9 @@
   va_list ap;
   va_start( ap, format );
-  
-  assert( vsnprintf( buf, NETWORK_LOG_BUFLEN, format, ap ) < NETWORK_LOG_BUFLEN );
-  
-  va_end( ap );
- 
+
+  assert( vsnprintf( buf, NETWORK_LOG_BUFLEN, format, ap ) < NETWORK_LOG_BUFLEN );
+
+  va_end( ap );
+
   printfnet();
 }
@@ -85,5 +86,5 @@
 {
   TCPsocket newSock = SDLNet_TCP_Accept( listensock );
-  
+
   if ( newSock )
     sockets.push_back( newSock );
@@ -97,9 +98,9 @@
   va_list ap;
   va_start( ap, format );
-  
-  assert( vsnprintf( buf, NETWORK_LOG_BUFLEN, format, ap ) < NETWORK_LOG_BUFLEN );
-  
-  va_end( ap );
-  
+
+  assert( vsnprintf( buf, NETWORK_LOG_BUFLEN, format, ap ) < NETWORK_LOG_BUFLEN );
+
+  va_end( ap );
+
   PRINT(0)( buf );
   printfnet();
@@ -114,9 +115,9 @@
   va_list ap;
   va_start( ap, format );
-  
-  assert( vsnprintf( buf, NETWORK_LOG_BUFLEN, format, ap ) < NETWORK_LOG_BUFLEN );
-  
-  va_end( ap );
-  
+
+  assert( vsnprintf( buf, NETWORK_LOG_BUFLEN, format, ap ) < NETWORK_LOG_BUFLEN );
+
+  va_end( ap );
+
   PRINT(1)( buf );
   printfnet();
@@ -131,9 +132,9 @@
   va_list ap;
   va_start( ap, format );
-  
-  assert( vsnprintf( buf, NETWORK_LOG_BUFLEN, format, ap ) < NETWORK_LOG_BUFLEN );
-  
-  va_end( ap );
-  
+
+  assert( vsnprintf( buf, NETWORK_LOG_BUFLEN, format, ap ) < NETWORK_LOG_BUFLEN );
+
+  va_end( ap );
+
   PRINT(2)( buf );
   printfnet();
@@ -148,9 +149,9 @@
   va_list ap;
   va_start( ap, format );
-  
-  assert( vsnprintf( buf, NETWORK_LOG_BUFLEN, format, ap ) < NETWORK_LOG_BUFLEN );
-  
-  va_end( ap );
-  
+
+  assert( vsnprintf( buf, NETWORK_LOG_BUFLEN, format, ap ) < NETWORK_LOG_BUFLEN );
+
+  va_end( ap );
+
   PRINT(3)( buf );
   printfnet();
@@ -165,9 +166,9 @@
   va_list ap;
   va_start( ap, format );
-  
-  assert( vsnprintf( buf, NETWORK_LOG_BUFLEN, format, ap ) < NETWORK_LOG_BUFLEN );
-  
-  va_end( ap );
-  
+
+  assert( vsnprintf( buf, NETWORK_LOG_BUFLEN, format, ap ) < NETWORK_LOG_BUFLEN );
+
+  va_end( ap );
+
   PRINT(4)( buf );
   printfnet();
@@ -182,9 +183,9 @@
   va_list ap;
   va_start( ap, format );
-  
-  assert( vsnprintf( buf, NETWORK_LOG_BUFLEN, format, ap ) < NETWORK_LOG_BUFLEN );
-  
-  va_end( ap );
-  
+
+  assert( vsnprintf( buf, NETWORK_LOG_BUFLEN, format, ap ) < NETWORK_LOG_BUFLEN );
+
+  va_end( ap );
+
   PRINT(5)( buf );
   printfnet();
@@ -200,5 +201,5 @@
   if ( !listensock )
     return;
-  
+
   acceptNewConnections();
 
@@ -213,5 +214,5 @@
       continue;
     }
-    
+
     it++;
   }
Index: branches/new_class_id/src/lib/network/network_manager.cc
===================================================================
--- branches/new_class_id/src/lib/network/network_manager.cc	(revision 9855)
+++ branches/new_class_id/src/lib/network/network_manager.cc	(revision 9856)
@@ -27,5 +27,5 @@
 #include "shared_network_data.h"
 #include "network_stream.h"
-#include "preferences.h"
+#include "parser/preferences/preferences.h"
 #include "network_log.h"
 #include "network_game_manager.h"
Index: branches/new_class_id/src/lib/network/network_stream.cc
===================================================================
--- branches/new_class_id/src/lib/network/network_stream.cc	(revision 9855)
+++ branches/new_class_id/src/lib/network/network_stream.cc	(revision 9856)
@@ -33,5 +33,5 @@
 #include "shared_network_data.h"
 #include "message_manager.h"
-#include "preferences.h"
+#include "parser/preferences/preferences.h"
 #include "zip.h"
 
Index: branches/new_class_id/src/lib/network/player_stats.cc
===================================================================
--- branches/new_class_id/src/lib/network/player_stats.cc	(revision 9855)
+++ branches/new_class_id/src/lib/network/player_stats.cc	(revision 9856)
@@ -25,5 +25,5 @@
 #include "converter.h"
 
-#include "preferences.h"
+#include "parser/preferences/preferences.h"
 
 #include "debug.h"
Index: branches/new_class_id/src/lib/network/proxy/proxy_control.cc
===================================================================
--- branches/new_class_id/src/lib/network/proxy/proxy_control.cc	(revision 9855)
+++ branches/new_class_id/src/lib/network/proxy/proxy_control.cc	(revision 9856)
@@ -27,5 +27,5 @@
 #include "converter.h"
 
-#include "preferences.h"
+#include "parser/preferences/preferences.h"
 
 #include "debug.h"
Index: branches/new_class_id/src/lib/parser/Makefile.am
===================================================================
--- branches/new_class_id/src/lib/parser/Makefile.am	(revision 9855)
+++ branches/new_class_id/src/lib/parser/Makefile.am	(revision 9856)
@@ -2,6 +2,6 @@
           tinyxml \
 	  ini_parser \
-	  preferences \
-	  cmdline_parser
+	  cmdline_parser \
+	  preferences
 
 
Index: branches/new_class_id/src/lib/parser/cmdline_parser/Makefile.am
===================================================================
--- branches/new_class_id/src/lib/parser/cmdline_parser/Makefile.am	(revision 9855)
+++ branches/new_class_id/src/lib/parser/cmdline_parser/Makefile.am	(revision 9856)
@@ -1,2 +1,4 @@
+
+INCLUDES=../../../../
 
 noinst_LIBRARIES = libCmdLineParser.a
Index: branches/new_class_id/src/lib/parser/cmdline_parser/cmdline_parser.h
===================================================================
--- branches/new_class_id/src/lib/parser/cmdline_parser/cmdline_parser.h	(revision 9855)
+++ branches/new_class_id/src/lib/parser/cmdline_parser/cmdline_parser.h	(revision 9856)
@@ -11,6 +11,6 @@
 #include <vector>
 
-#include "src/defs/debug.h"
-#include "src/lib/util/multi_type.h"
+#include "defs/debug.h"
+#include "util/multi_type.h"
 
 
Index: branches/new_class_id/src/lib/parser/preferences/Makefile.am
===================================================================
--- branches/new_class_id/src/lib/parser/preferences/Makefile.am	(revision 9855)
+++ branches/new_class_id/src/lib/parser/preferences/Makefile.am	(revision 9856)
@@ -6,8 +6,10 @@
 libPrefsParser_a_SOURCES = \
 		cmd_line_prefs_reader.cc \
-		ini_file_prefs_reader.cc
+		ini_file_prefs_reader.cc \
+		preferences.cc
 
 
 noinst_HEADERS = \
 		cmd_line_prefs_reader.h \
-		ini_file_prefs_reader.h
+		ini_file_prefs_reader.h \
+		preferences.h
Index: branches/new_class_id/src/lib/parser/preferences/cmd_line_prefs_reader.h
===================================================================
--- branches/new_class_id/src/lib/parser/preferences/cmd_line_prefs_reader.h	(revision 9855)
+++ branches/new_class_id/src/lib/parser/preferences/cmd_line_prefs_reader.h	(revision 9856)
@@ -7,5 +7,4 @@
 #define _CMD_LINE_PREFS_READER_H
 
-#include "stdincl.h"
 #include "debug.h"
 
@@ -45,10 +44,10 @@
 };
 
-#define REGISTER_ARG_FLAG(shortOption,longOption,section,key,description,value) bool _ARGVAR_##shortOption##_##longOption = CmdLinePrefsReader::registerArgument(#shortOption[0],#longOption,section,key,description,"",value) 
+#define REGISTER_ARG_FLAG(shortOption,longOption,section,key,description,value) bool _ARGVAR_##shortOption##_##longOption = CmdLinePrefsReader::registerArgument(#shortOption[0],#longOption,section,key,description,"",value)
 
-#define REGISTER_ARG_ARG(shortOption,longOption,section,key,description,argname) bool _ARGVAR_##shortOption##_##longOption = CmdLinePrefsReader::registerArgument(#shortOption[0],#longOption,section,key,description,argname) 
+#define REGISTER_ARG_ARG(shortOption,longOption,section,key,description,argname) bool _ARGVAR_##shortOption##_##longOption = CmdLinePrefsReader::registerArgument(#shortOption[0],#longOption,section,key,description,argname)
 
 //! A class for reading commandline arguments into Preferences
-class CmdLinePrefsReader 
+class CmdLinePrefsReader
 {
 
@@ -58,12 +57,12 @@
 
     bool parse(int argc, char** argv);
-    
+
     static bool registerArgument( const char shortOption, const std::string & longOption, const std::string & section, const std::string & key, const std::string & help,  const std::string & argName = "", const std::string & value = "%arg%" );
-    
+
     static bool asdf;
-    
+
   private:
     static bool callBack( ArgTableEntry entry, void* data, const std::string & arg, const std::vector<MultiType> & argArgs );
-    
+
     static RegistredArgs regArgs;
 
Index: branches/new_class_id/src/lib/parser/preferences/preferences.cc
===================================================================
--- branches/new_class_id/src/lib/parser/preferences/preferences.cc	(revision 9856)
+++ branches/new_class_id/src/lib/parser/preferences/preferences.cc	(revision 9856)
@@ -0,0 +1,335 @@
+/*
+   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: Christoph Renner
+   co-programmer: ...
+*/
+
+//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
+
+#include "preferences.h"
+#include "lib/parser/ini_parser/ini_parser.h"
+#include "debug.h"
+
+ObjectListDefinition(Preferences);
+
+/**
+ * standard constructor
+ */
+Preferences::Preferences ()
+{
+  this->registerObject(this, Preferences::_objectList);
+   this->setName("Preferences");
+   this->fileName = "";
+}
+
+/**
+ *  the singleton reference to this class
+ */
+Preferences* Preferences::singletonRef = NULL;
+
+/**
+   @brief standard deconstructor
+ */
+Preferences::~Preferences ()
+{
+  Preferences::singletonRef = NULL;
+}
+
+/**
+ * Check if this item exists
+ * @param section name of the section
+ * @param name name of the item to check
+ * @return true if the item exists
+ */
+bool Preferences::exists( const std::string& section, const std::string& name)
+{
+  std::list<prefSection>::const_iterator it = data.begin();
+
+  for ( ; it!=data.end(); it++)
+  {
+    if ( it->sectionName == section )
+    {
+      std::list<prefItem>::const_iterator it2 = it->items.begin();
+
+      for ( ; it2!=it->items.end(); it2++)
+      {
+        if ( it2->name == name )
+          return true;
+      }
+
+      break;
+    }
+  }
+
+  return false;
+}
+
+/**
+ * Check if this section exists
+ * @param section name of the section
+ * @param name name of the item to check
+ * @return true if the item exists
+ */
+bool Preferences::sectionExists( const std::string& section )
+{
+  std::list<prefSection>::const_iterator it = data.begin();
+
+  for ( ; it!=data.end(); it++)
+  {
+    if ( it->sectionName == section )
+    {
+      return true;
+    }
+  }
+
+  return false;
+}
+
+/**
+ * Sets the value of an item. Creates it if doesn't exits.
+ * @param section name of the section
+ * @param name name of the item
+ * @param value value
+ */
+void Preferences::setString(const std::string& section, const std::string& name, const std::string& value, bool dontSetModified)
+{
+  MultiType t(value);
+  setMultiType(section, name, t, dontSetModified);
+}
+
+/**
+ * Sets the value of an item. Creates it if doesn't exits.
+ * @param section name of the section
+ * @param name name of the item
+ * @param value value
+ */
+void Preferences::setInt(const std::string& section, const std::string& name, int value, bool dontSetModified)
+{
+  MultiType t(value);
+  setMultiType(section, name, t, dontSetModified);
+}
+
+/**
+ * Sets the value of an item. Creates it if doesn't exits.
+ * @param section name of the section
+ * @param name name of the item
+ * @param value value
+ */
+void Preferences::setFloat(const std::string& section, const std::string& name, float value, bool dontSetModified)
+{
+  MultiType t(value);
+  setMultiType(section, name, t, dontSetModified);
+}
+
+/**
+ * Get the value of an item
+ * @param section name of the section
+ * @param name name of the item to check
+ * @param defaultValue value to return if item doesn't exist
+ * @return value of the item if found. defaultValue else
+ */
+std::string Preferences::getString(const std::string& section, const std::string& name, const std::string& defaultValue)
+{
+  return getMultiType(section, name, MultiType(defaultValue)).getString();
+}
+
+/**
+ * Get the value of an item
+ * @param section name of the section
+ * @param name name of the item to check
+ * @param defaultValue value to return if item doesn't exist
+ * @return value of the item if found. defaultValue else
+ */
+int Preferences::getInt(const std::string& section, const std::string& name, int defaultValue)
+{
+  return getMultiType(section, name, MultiType(defaultValue)).getInt();
+}
+
+/**
+ * Get the value of an item
+ * @param section name of the section
+ * @param name name of the item to check
+ * @param defaultValue value to return if item doesn't exist
+ * @return value of the item if found. defaultValue else
+ */
+float Preferences::getFloat(const std::string& section, const std::string& name, float defaultValue)
+{
+  return getMultiType(section, name, MultiType(defaultValue)).getFloat();
+}
+
+/**
+ * Sets the value of an item. Creates it if doesn't exits.
+ * @param section name of the section
+ * @param name name of the item
+ * @param value value
+ */
+void Preferences::setMultiType(const std::string& section, const std::string& name, const MultiType& value, bool dontSetModified)
+{
+  std::list<prefSection>::iterator it = data.begin();
+
+  for ( ; it!=data.end(); it++)
+  {
+    if ( it->sectionName == section )
+    {
+      std::list<prefItem>::iterator it2 = it->items.begin();
+
+      for ( ; it2!=it->items.end(); it2++)
+      {
+        if ( it2->name == name )
+        {
+          if (!dontSetModified)
+            it2->modified = value.getString() != it2->value.getString();
+
+          it2->value = value;
+
+          return;
+        }
+      }
+      prefItem item;
+      item.value = value;
+      item.modified = !dontSetModified;
+      item.name = name;
+      it->items.push_back(item);
+      return;
+    }
+  }
+
+  prefItem item;
+  item.value = value;
+  item.modified = !dontSetModified;
+  item.name = name;
+
+  prefSection sec;
+  sec.items.push_back(item);
+  sec.sectionName = section;
+  data.push_back( sec );
+}
+
+/**
+ * Get the value of an item
+ * @param section name of the section
+ * @param name name of the item to check
+ * @param defaultValue value to return if item doesn't exist
+ * @return value of the item if found. defaultValue else
+ */
+MultiType Preferences::getMultiType(const std::string& section, const std::string& name,const MultiType& defaultValue)
+{
+  std::list<prefSection>::const_iterator it = data.begin();
+
+  for ( ; it!=data.end(); it++)
+  {
+    if ( it->sectionName == section )
+    {
+      std::list<prefItem>::const_iterator it2 = it->items.begin();
+
+      for ( ; it2!=it->items.end(); it2++)
+      {
+        if ( it2->name == name )
+        {
+          return it2->value;
+        }
+      }
+
+      break;
+    }
+  }
+
+  return defaultValue;
+}
+
+void Preferences::setUserIni(const std::string& fileName)
+{
+  this->fileName = fileName;
+}
+
+bool Preferences::save()
+{
+  if ( this->fileName == "" )
+  {
+    PRINTF(1)("You must call setUserIni before you can call save()\n");
+    return false;
+  }
+  IniParser iniParser(this->fileName);
+
+  std::list<prefSection>::iterator it = data.begin();
+  bool didChanges = false;
+  for ( ; it!=data.end(); it++)
+  {
+    std::list<prefItem>::iterator it2 = it->items.begin();
+
+    for ( ; it2!=it->items.end(); it2++)
+    {
+      if ( it2->modified )
+      {
+        iniParser.editVar(it2->name, it2->value.getString(), it->sectionName);
+        didChanges = true;
+      }
+    }
+  }
+  /// HACK DO WE HAVE TO CHECK THIS??
+  //if ( didChanges )
+  {
+    iniParser.writeFile( this->fileName );
+  }
+
+  return true;
+}
+
+/**
+ * prints out all section with its items and values
+ */
+void Preferences::debug()
+{
+  std::list<prefSection>::iterator it = data.begin();
+
+  for ( ; it!=data.end(); it++)
+  {
+    PRINTF(0)("%s\n", it->sectionName.c_str());
+    std::list<prefItem>::iterator it2 = it->items.begin();
+
+    for ( ; it2!=it->items.end(); it2++)
+    {
+      PRINTF(0)("--> %s = '%s'%s\n", it2->name.c_str(), it2->value.getString().c_str(), ((!it2->modified)?"":" <modified>"));
+    }
+  }
+}
+
+/**
+ * list all keys in section
+ * @param section section
+ * @return list of keys
+ */
+std::list< std::string > Preferences::listKeys( const std::string section )
+{
+  std::list<std::string> lst;
+
+  std::list<prefSection>::const_iterator it = data.begin();
+
+  for ( ; it!=data.end(); it++)
+  {
+    if ( it->sectionName == section )
+    {
+      std::list<prefItem>::const_iterator it2 = it->items.begin();
+
+      for ( ; it2!=it->items.end(); it2++)
+      {
+        lst.push_back( it2->name );
+      }
+
+      break;
+    }
+  }
+
+  return lst;
+}
+
+
Index: branches/new_class_id/src/lib/parser/preferences/preferences.h
===================================================================
--- branches/new_class_id/src/lib/parser/preferences/preferences.h	(revision 9856)
+++ branches/new_class_id/src/lib/parser/preferences/preferences.h	(revision 9856)
@@ -0,0 +1,72 @@
+/*!
+ * @file proto_singleton.h
+ * @brief Definition of the ... singleton Class
+*/
+
+#ifndef _PREFERENCES_H
+#define _PREFERENCES_H
+
+#include "base_object.h"
+#include "multi_type.h"
+#include <list>
+
+// FORWARD DECLARATION
+
+class IniFilePrefsReader;
+
+typedef struct {
+  std::string name;
+  MultiType value;
+  bool modified;
+} prefItem;
+
+typedef struct {
+  std::string sectionName;
+  std::list<prefItem> items;
+} prefSection ;
+
+
+//! A default singleton class.
+class Preferences : public BaseObject {
+  ObjectListDeclaration(Preferences);
+ public:
+   virtual ~Preferences(void);
+  /** @returns a Pointer to the only object of this Class */
+   inline static Preferences* getInstance(void) { if (!singletonRef) singletonRef = new Preferences();  return singletonRef; };
+
+   //check if this entry exists
+   bool sectionExists(const std::string& section );
+   bool exists(const std::string& section, const std::string& name);
+
+   void setString(const std::string& section, const std::string& name, const std::string& value, bool dontSetModified = false);
+   void setInt(const std::string& section, const std::string& name, int value, bool dontSetModified = false);
+   void setFloat(const std::string& section, const std::string& name, float value, bool dontSetModified = false);
+   void setMultiType(const std::string& section, const std::string& name, const MultiType& value, bool dontSetModified = false);
+
+   std::string getString(const std::string& section, const std::string& name, const std::string& defaultValue);
+   int getInt(const std::string& section, const std::string& name, int defaultValue);
+   float getFloat(const std::string& section, const std::string& name, float defaultValue);
+   MultiType getMultiType(const std::string& section, const std::string& name, const MultiType& defaultValue);
+
+   void setUserIni(const std::string& fileName);
+
+   bool save();
+
+   void debug();
+
+   std::list<std::string> listKeys( const std::string section );
+
+
+ private:
+   Preferences(void);
+   static Preferences* singletonRef;
+
+   std::list<prefSection> data;
+
+   std::list<IniFilePrefsReader*> iniFilePrefsReaders;
+
+   std::string fileName;
+
+};
+
+#endif /* _PREFERENCES_H */
Index: branches/new_class_id/src/lib/shell/shell_buffer.cc
===================================================================
--- branches/new_class_id/src/lib/shell/shell_buffer.cc	(revision 9855)
+++ branches/new_class_id/src/lib/shell/shell_buffer.cc	(revision 9856)
@@ -21,5 +21,5 @@
 
 #include "debug.h"
-#include "shell.h"
+#include "compiler.h"
 #include "lib/util/threading.h"
 
Index: branches/new_class_id/src/lib/sound/sound_engine.cc
===================================================================
--- branches/new_class_id/src/lib/sound/sound_engine.cc	(revision 9855)
+++ branches/new_class_id/src/lib/sound/sound_engine.cc	(revision 9856)
@@ -23,5 +23,5 @@
 #include "p_node.h"
 #include "debug.h"
-#include "util/preferences.h"
+#include "parser/preferences/preferences.h"
 #include "globals.h"
 #include "resource_sound_buffer.h"
Index: branches/new_class_id/src/lib/util/Makefile.am
===================================================================
--- branches/new_class_id/src/lib/util/Makefile.am	(revision 9855)
+++ branches/new_class_id/src/lib/util/Makefile.am	(revision 9856)
@@ -28,5 +28,4 @@
 		filesys/net_link.cc \
 		\
-		preferences.cc \
 		threading.cc \
 		timer.cc
@@ -61,5 +60,4 @@
 		filesys/net_link.h \
 		\
-		preferences.h \
 		threading.h \
 		timer.h \
Index: branches/new_class_id/src/lib/util/loading/load_param_class_description.cc
===================================================================
--- branches/new_class_id/src/lib/util/loading/load_param_class_description.cc	(revision 9855)
+++ branches/new_class_id/src/lib/util/loading/load_param_class_description.cc	(revision 9856)
@@ -18,4 +18,5 @@
 #include "multi_type.h"
 #include "debug.h"
+#include <cassert>
 
 /**
Index: branches/new_class_id/src/lib/util/preferences.cc
===================================================================
--- branches/new_class_id/src/lib/util/preferences.cc	(revision 9855)
+++ 	(revision )
@@ -1,335 +1,0 @@
-/*
-   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: Christoph Renner
-   co-programmer: ...
-*/
-
-//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
-
-#include "preferences.h"
-#include "lib/parser/ini_parser/ini_parser.h"
-#include "debug.h"
-
-ObjectListDefinition(Preferences);
-
-/**
- * standard constructor
- */
-Preferences::Preferences ()
-{
-  this->registerObject(this, Preferences::_objectList);
-   this->setName("Preferences");
-   this->fileName = "";
-}
-
-/**
- *  the singleton reference to this class
- */
-Preferences* Preferences::singletonRef = NULL;
-
-/**
-   @brief standard deconstructor
- */
-Preferences::~Preferences ()
-{
-  Preferences::singletonRef = NULL;
-}
-
-/**
- * Check if this item exists
- * @param section name of the section
- * @param name name of the item to check
- * @return true if the item exists
- */
-bool Preferences::exists( const std::string& section, const std::string& name)
-{
-  std::list<prefSection>::const_iterator it = data.begin();
-
-  for ( ; it!=data.end(); it++)
-  {
-    if ( it->sectionName == section )
-    {
-      std::list<prefItem>::const_iterator it2 = it->items.begin();
-
-      for ( ; it2!=it->items.end(); it2++)
-      {
-        if ( it2->name == name )
-          return true;
-      }
-
-      break;
-    }
-  }
-
-  return false;
-}
-
-/**
- * Check if this section exists
- * @param section name of the section
- * @param name name of the item to check
- * @return true if the item exists
- */
-bool Preferences::sectionExists( const std::string& section )
-{
-  std::list<prefSection>::const_iterator it = data.begin();
-
-  for ( ; it!=data.end(); it++)
-  {
-    if ( it->sectionName == section )
-    {
-      return true;
-    }
-  }
-
-  return false;
-}
-
-/**
- * Sets the value of an item. Creates it if doesn't exits.
- * @param section name of the section
- * @param name name of the item
- * @param value value
- */
-void Preferences::setString(const std::string& section, const std::string& name, const std::string& value, bool dontSetModified)
-{
-  MultiType t(value);
-  setMultiType(section, name, t, dontSetModified);
-}
-
-/**
- * Sets the value of an item. Creates it if doesn't exits.
- * @param section name of the section
- * @param name name of the item
- * @param value value
- */
-void Preferences::setInt(const std::string& section, const std::string& name, int value, bool dontSetModified)
-{
-  MultiType t(value);
-  setMultiType(section, name, t, dontSetModified);
-}
-
-/**
- * Sets the value of an item. Creates it if doesn't exits.
- * @param section name of the section
- * @param name name of the item
- * @param value value
- */
-void Preferences::setFloat(const std::string& section, const std::string& name, float value, bool dontSetModified)
-{
-  MultiType t(value);
-  setMultiType(section, name, t, dontSetModified);
-}
-
-/**
- * Get the value of an item
- * @param section name of the section
- * @param name name of the item to check
- * @param defaultValue value to return if item doesn't exist
- * @return value of the item if found. defaultValue else
- */
-std::string Preferences::getString(const std::string& section, const std::string& name, const std::string& defaultValue)
-{
-  return getMultiType(section, name, MultiType(defaultValue)).getString();
-}
-
-/**
- * Get the value of an item
- * @param section name of the section
- * @param name name of the item to check
- * @param defaultValue value to return if item doesn't exist
- * @return value of the item if found. defaultValue else
- */
-int Preferences::getInt(const std::string& section, const std::string& name, int defaultValue)
-{
-  return getMultiType(section, name, MultiType(defaultValue)).getInt();
-}
-
-/**
- * Get the value of an item
- * @param section name of the section
- * @param name name of the item to check
- * @param defaultValue value to return if item doesn't exist
- * @return value of the item if found. defaultValue else
- */
-float Preferences::getFloat(const std::string& section, const std::string& name, float defaultValue)
-{
-  return getMultiType(section, name, MultiType(defaultValue)).getFloat();
-}
-
-/**
- * Sets the value of an item. Creates it if doesn't exits.
- * @param section name of the section
- * @param name name of the item
- * @param value value
- */
-void Preferences::setMultiType(const std::string& section, const std::string& name, const MultiType& value, bool dontSetModified)
-{
-  std::list<prefSection>::iterator it = data.begin();
-
-  for ( ; it!=data.end(); it++)
-  {
-    if ( it->sectionName == section )
-    {
-      std::list<prefItem>::iterator it2 = it->items.begin();
-
-      for ( ; it2!=it->items.end(); it2++)
-      {
-        if ( it2->name == name )
-        {
-          if (!dontSetModified)
-            it2->modified = value.getString() != it2->value.getString();
-
-          it2->value = value;
-
-          return;
-        }
-      }
-      prefItem item;
-      item.value = value;
-      item.modified = !dontSetModified;
-      item.name = name;
-      it->items.push_back(item);
-      return;
-    }
-  }
-
-  prefItem item;
-  item.value = value;
-  item.modified = !dontSetModified;
-  item.name = name;
-
-  prefSection sec;
-  sec.items.push_back(item);
-  sec.sectionName = section;
-  data.push_back( sec );
-}
-
-/**
- * Get the value of an item
- * @param section name of the section
- * @param name name of the item to check
- * @param defaultValue value to return if item doesn't exist
- * @return value of the item if found. defaultValue else
- */
-MultiType Preferences::getMultiType(const std::string& section, const std::string& name,const MultiType& defaultValue)
-{
-  std::list<prefSection>::const_iterator it = data.begin();
-
-  for ( ; it!=data.end(); it++)
-  {
-    if ( it->sectionName == section )
-    {
-      std::list<prefItem>::const_iterator it2 = it->items.begin();
-
-      for ( ; it2!=it->items.end(); it2++)
-      {
-        if ( it2->name == name )
-        {
-          return it2->value;
-        }
-      }
-
-      break;
-    }
-  }
-
-  return defaultValue;
-}
-
-void Preferences::setUserIni(const std::string& fileName)
-{
-  this->fileName = fileName;
-}
-
-bool Preferences::save()
-{
-  if ( this->fileName == "" )
-  {
-    PRINTF(1)("You must call setUserIni before you can call save()\n");
-    return false;
-  }
-  IniParser iniParser(this->fileName);
-
-  std::list<prefSection>::iterator it = data.begin();
-  bool didChanges = false;
-  for ( ; it!=data.end(); it++)
-  {
-    std::list<prefItem>::iterator it2 = it->items.begin();
-
-    for ( ; it2!=it->items.end(); it2++)
-    {
-      if ( it2->modified )
-      {
-        iniParser.editVar(it2->name, it2->value.getString(), it->sectionName);
-        didChanges = true;
-      }
-    }
-  }
-  /// HACK DO WE HAVE TO CHECK THIS??
-  //if ( didChanges )
-  {
-    iniParser.writeFile( this->fileName );
-  }
-
-  return true;
-}
-
-/**
- * prints out all section with its items and values
- */
-void Preferences::debug()
-{
-  std::list<prefSection>::iterator it = data.begin();
-
-  for ( ; it!=data.end(); it++)
-  {
-    PRINTF(0)("%s\n", it->sectionName.c_str());
-    std::list<prefItem>::iterator it2 = it->items.begin();
-
-    for ( ; it2!=it->items.end(); it2++)
-    {
-      PRINTF(0)("--> %s = '%s'%s\n", it2->name.c_str(), it2->value.getString().c_str(), ((!it2->modified)?"":" <modified>"));
-    }
-  }
-}
-
-/**
- * list all keys in section
- * @param section section
- * @return list of keys
- */
-std::list< std::string > Preferences::listKeys( const std::string section )
-{
-  std::list<std::string> lst;
-
-  std::list<prefSection>::const_iterator it = data.begin();
-
-  for ( ; it!=data.end(); it++)
-  {
-    if ( it->sectionName == section )
-    {
-      std::list<prefItem>::const_iterator it2 = it->items.begin();
-
-      for ( ; it2!=it->items.end(); it2++)
-      {
-        lst.push_back( it2->name );
-      }
-
-      break;
-    }
-  }
-
-  return lst;
-}
-
-
Index: branches/new_class_id/src/lib/util/preferences.h
===================================================================
--- branches/new_class_id/src/lib/util/preferences.h	(revision 9855)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*!
- * @file proto_singleton.h
- * @brief Definition of the ... singleton Class
-*/
-
-#ifndef _PREFERENCES_H
-#define _PREFERENCES_H
-
-#include "base_object.h"
-#include "multi_type.h"
-#include <list>
-
-// FORWARD DECLARATION
-
-class IniFilePrefsReader;
-
-typedef struct {
-  std::string name;
-  MultiType value;
-  bool modified;
-} prefItem;
-
-typedef struct {
-  std::string sectionName;
-  std::list<prefItem> items;
-} prefSection ;
-
-
-//! A default singleton class.
-class Preferences : public BaseObject {
-  ObjectListDeclaration(Preferences);
- public:
-   virtual ~Preferences(void);
-  /** @returns a Pointer to the only object of this Class */
-   inline static Preferences* getInstance(void) { if (!singletonRef) singletonRef = new Preferences();  return singletonRef; };
-
-   //check if this entry exists
-   bool sectionExists(const std::string& section );
-   bool exists(const std::string& section, const std::string& name);
-
-   void setString(const std::string& section, const std::string& name, const std::string& value, bool dontSetModified = false);
-   void setInt(const std::string& section, const std::string& name, int value, bool dontSetModified = false);
-   void setFloat(const std::string& section, const std::string& name, float value, bool dontSetModified = false);
-   void setMultiType(const std::string& section, const std::string& name, const MultiType& value, bool dontSetModified = false);
-
-   std::string getString(const std::string& section, const std::string& name, const std::string& defaultValue);
-   int getInt(const std::string& section, const std::string& name, int defaultValue);
-   float getFloat(const std::string& section, const std::string& name, float defaultValue);
-   MultiType getMultiType(const std::string& section, const std::string& name, const MultiType& defaultValue);
-
-   void setUserIni(const std::string& fileName);
-
-   bool save();
-
-   void debug();
-
-   std::list<std::string> listKeys( const std::string section );
-
-
- private:
-   Preferences(void);
-   static Preferences* singletonRef;
-
-   std::list<prefSection> data;
-
-   std::list<IniFilePrefsReader*> iniFilePrefsReaders;
-
-   std::string fileName;
-
-};
-
-#endif /* _PREFERENCES_H */
