Index: code/branches/core6/src/libraries/core/CMakeLists.txt
===================================================================
--- code/branches/core6/src/libraries/core/CMakeLists.txt	(revision 9558)
+++ code/branches/core6/src/libraries/core/CMakeLists.txt	(revision 9559)
@@ -54,5 +54,5 @@
 BUILD_UNIT FilesystemBuildUnit.cc
   command/ArgumentCompletionFunctions.cc
-  config/ConfigFileManager.cc
+  config/ConfigFile.cc
   PathConfig.cc
 END_BUILD_UNIT
@@ -74,5 +74,5 @@
   TOLUA_FILES
     command/CommandExecutor.h
-    config/ConfigFileManager.h
+    config/SettingsConfigFile.h
     Game.h
     GameMode.h
Index: code/branches/core6/src/libraries/core/command/ArgumentCompletionFunctions.cc
===================================================================
--- code/branches/core6/src/libraries/core/command/ArgumentCompletionFunctions.cc	(revision 9558)
+++ code/branches/core6/src/libraries/core/command/ArgumentCompletionFunctions.cc	(revision 9559)
@@ -40,5 +40,5 @@
 #include "util/StringUtils.h"
 #include "core/Identifier.h"
-#include "core/config/ConfigFileManager.h"
+#include "core/config/SettingsConfigFile.h"
 #include "core/config/ConfigValueContainer.h"
 #include "CommandExecutor.h"
Index: code/branches/core6/src/libraries/core/config/CMakeLists.txt
===================================================================
--- code/branches/core6/src/libraries/core/config/CMakeLists.txt	(revision 9558)
+++ code/branches/core6/src/libraries/core/config/CMakeLists.txt	(revision 9559)
@@ -1,3 +1,9 @@
 ADD_SOURCE_FILES(CORE_SRC_FILES
+#  ConfigFile.cc is already included in FilesystemBuildUnit.cc
+  ConfigFileEntryValue.cc
+  ConfigFileEntryVectorValue.cc
+  ConfigFileManager.cc
+  ConfigFileSection.cc
   ConfigValueContainer.cc
+  SettingsConfigFile.cc
 )
Index: code/branches/core6/src/libraries/core/config/ConfigFile.cc
===================================================================
--- code/branches/core6/src/libraries/core/config/ConfigFile.cc	(revision 9559)
+++ code/branches/core6/src/libraries/core/config/ConfigFile.cc	(revision 9559)
@@ -0,0 +1,318 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of ConfigFile.
+*/
+
+#include "ConfigFile.h"
+
+#include <boost/filesystem.hpp>
+
+#include "util/Convert.h"
+#include "util/StringUtils.h"
+#include "core/PathConfig.h"
+#include "ConfigFileEntryComment.h"
+#include "ConfigFileEntryValue.h"
+
+namespace orxonox
+{
+    ////////////////
+    // ConfigFile //
+    ////////////////
+
+    const char* ConfigFile::DEFAULT_CONFIG_FOLDER = "defaultConfig";
+
+    /**
+        @brief Constructor: Initializes the config file.
+        @param filename The file-name of this config file
+        @param bCopyFallbackFile If true, the default config file is copied into the config-directory before loading the file
+    */
+    ConfigFile::ConfigFile(const std::string& filename, bool bCopyFallbackFile)
+        : filename_(filename)
+        , bCopyFallbackFile_(bCopyFallbackFile)
+        , bUpdated_(false)
+    {
+    }
+
+    /**
+        @brief Destructor: Deletes all sections and entries.
+    */
+    ConfigFile::~ConfigFile()
+    {
+        this->clear();
+    }
+
+    /**
+        @brief Loads the config file from the hard-disk and reads the sections and their values.
+    */
+    void ConfigFile::load()
+    {
+        // Be sure we start from new in the memory
+        this->clear();
+
+        boost::filesystem::path filepath(this->filename_);
+        if (!filepath.is_complete())
+        {
+            filepath = PathConfig::getConfigPath() / filepath;
+            if (this->bCopyFallbackFile_)
+            {
+                // Look for default file in the data folder
+                if (!boost::filesystem::exists(filepath))
+                {
+                    boost::filesystem::path defaultFilepath(PathConfig::getDataPath() / DEFAULT_CONFIG_FOLDER / this->filename_);
+                    if (boost::filesystem::exists(defaultFilepath))
+                    {
+                        // Try to copy default file from the data folder
+                        try
+                        {
+                            boost::filesystem::copy_file(defaultFilepath, filepath);
+                            orxout(internal_info, context::config) << "Copied " << this->filename_ << " from the default config folder." << endl;
+                        }
+                        catch (const boost::filesystem::filesystem_error& ex)
+                        { orxout(user_error, context::config) << "Error in ConfigFile: " << ex.what() << endl; }
+                    }
+                }
+            }
+        }
+
+        // Open the file
+        std::ifstream file;
+        file.open(filepath.string().c_str(), std::fstream::in);
+        if (file.is_open())
+        {
+            ConfigFileSection* newsection = 0;
+
+            while (file.good() && !file.eof())
+            {
+                std::string line;
+                std::getline(file, line);
+
+                const std::string& temp = getStripped(line);
+                if (!isEmpty(temp) && !isComment(temp))
+                {
+                    size_t   pos1 = temp.find('[');
+                    if (pos1 == 0) pos1 = line.find('['); else pos1 = std::string::npos;
+                    size_t   pos2 = line.find(']');
+
+                    if (pos1 != std::string::npos && pos2 != std::string::npos && pos2 > pos1 + 1)
+                    {
+                        // New section
+                        const std::string& comment = line.substr(pos2 + 1);
+                        if (isComment(comment))
+                            newsection = new ConfigFileSection(line.substr(pos1 + 1, pos2 - pos1 - 1), comment);
+                        else
+                            newsection = new ConfigFileSection(line.substr(pos1 + 1, pos2 - pos1 - 1));
+                        this->sections_.insert(this->sections_.end(), newsection);
+                        continue;
+                    }
+                }
+
+                if (newsection != 0)
+                {
+                    if (isComment(line))
+                    {
+                        // New comment
+                        newsection->getEntries().insert(newsection->getEntries().end(), new ConfigFileEntryComment(removeTrailingWhitespaces(line)));
+                        continue;
+                    }
+                    else
+                    {
+                        size_t pos1 = line.find('=');
+
+                        if (pos1 != std::string::npos && pos1 > 0)
+                        {
+                            // New entry
+                            size_t pos2 = line.find('[');
+                            size_t pos3 = line.find(']');
+                            size_t commentposition = getNextCommentPosition(line, pos1 + 1);
+                            while (isBetweenQuotes(line, commentposition))
+                            {
+                                commentposition = getNextCommentPosition(line, commentposition + 1);
+                            }
+                            std::string value, comment;
+                            if (commentposition == std::string::npos)
+                            {
+                                value = line.substr(pos1 + 1);
+                            }
+                            else
+                            {
+                                value = line.substr(pos1 + 1, commentposition - pos1 - 1);
+                                comment = removeTrailingWhitespaces(line.substr(commentposition));
+                            }
+
+                            value = removeTrailingWhitespaces(value);
+                            value = removeSlashes(value);
+
+                            if (pos2 != std::string::npos && pos3 != std::string::npos && pos3 > pos2 + 1)
+                            {
+                                // There might be an array index
+                                unsigned int index = 0;
+                                if (convertValue(&index, line.substr(pos2 + 1, pos3 - pos2 - 1)))
+                                {
+                                    // New array
+                                    std::list<ConfigFileEntry*>::iterator it = newsection->getOrCreateEntryIterator(getStripped(line.substr(0, pos2)), index, value, false);
+                                    (*it)->setValue(value);
+                                    (*it)->setComment(comment);
+                                    continue;
+                                }
+                            }
+
+                            // New value
+                            newsection->getEntries().insert(newsection->getEntries().end(), new ConfigFileEntryValue(getStripped(line.substr(0, pos1)), value, false, comment));
+                            continue;
+                        }
+                    }
+                }
+            }
+
+            file.close();
+
+            orxout(internal_info, context::config) << "Loaded config file \"" << this->filename_ << "\"." << endl;
+
+            // DO NOT save the file --> we can open supposedly read only config files
+        } // end file.is_open()
+    }
+
+    /**
+        @brief Writes the sections and values to the hard-disk.
+    */
+    void ConfigFile::save() const
+    {
+        this->saveAs(this->filename_);
+    }
+
+    /**
+        @brief Writes the sections and values to a given file on the hard-disk.
+    */
+    void ConfigFile::saveAs(const std::string& filename) const
+    {
+        boost::filesystem::path filepath(filename);
+        if (!filepath.is_complete())
+            filepath = PathConfig::getConfigPath() / filename;
+        std::ofstream file;
+        file.open(filepath.string().c_str(), std::fstream::out);
+        file.setf(std::ios::fixed, std::ios::floatfield);
+        file.precision(6);
+
+        if (!file.is_open())
+        {
+            orxout(user_error, context::config) << "Couldn't open config-file \"" << filename << "\"." << endl;
+            return;
+        }
+
+        for (std::list<ConfigFileSection*>::const_iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
+        {
+            file << (*it)->getFileEntry() << endl;
+
+            for (std::list<ConfigFileEntry*>::const_iterator it_entries = (*it)->getEntriesBegin(); it_entries != (*it)->getEntriesEnd(); ++it_entries)
+                file << (*it_entries)->getFileEntry() << endl;
+
+            file << endl;
+        }
+
+        file.close();
+
+        orxout(verbose, context::config) << "Saved config file \"" << filename << "\"." << endl;
+    }
+
+    /**
+        @brief Deletes all sections (which again delete all their values) and clears the list of sections.
+    */
+    void ConfigFile::clear()
+    {
+        for (std::list<ConfigFileSection*>::iterator it = this->sections_.begin(); it != this->sections_.end(); )
+            delete (*(it++));
+        this->sections_.clear();
+    }
+
+    /**
+        @brief Deletes all elements of a config vector if their index is greater or equal to @a startindex.
+
+        @param section      The name of the section
+        @param name         The name of the vector
+        @param startindex   The index of the first element that will be deleted
+    */
+    void ConfigFile::deleteVectorEntries(const std::string& section, const std::string& name, unsigned int startindex)
+    {
+        if (ConfigFileSection* sectionPtr = this->getSection(section))
+        {
+            sectionPtr->deleteVectorEntries(name, startindex);
+            this->save();
+        }
+    }
+
+    /**
+        @brief Returns a pointer to the section with given name (or NULL if the section doesn't exist).
+    */
+    ConfigFileSection* ConfigFile::getSection(const std::string& section) const
+    {
+        for (std::list<ConfigFileSection*>::const_iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
+            if ((*it)->getName() == section)
+                return (*it);
+        return NULL;
+    }
+
+    /**
+        @brief Returns a pointer to the section with given name. If it doesn't exist, the section is created.
+    */
+    ConfigFileSection* ConfigFile::getOrCreateSection(const std::string& section)
+    {
+        for (std::list<ConfigFileSection*>::iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
+            if ((*it)->getName() == section)
+                return (*it);
+
+        this->bUpdated_ = true;
+
+        return (*this->sections_.insert(this->sections_.end(), new ConfigFileSection(section)));
+    }
+
+    /**
+        @brief Saves the config file if it was updated (or if any of its sections were updated).
+    */
+    void ConfigFile::saveIfUpdated()
+    {
+        bool sectionsUpdated = false;
+
+        for (std::list<ConfigFileSection*>::iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
+        {
+            if ((*it)->bUpdated_)
+            {
+                sectionsUpdated = true;
+                (*it)->bUpdated_ = false;
+            }
+        }
+
+        if (this->bUpdated_ || sectionsUpdated)
+        {
+            this->bUpdated_ = false;
+            this->save();
+        }
+    }
+}
Index: code/branches/core6/src/libraries/core/config/ConfigFile.h
===================================================================
--- code/branches/core6/src/libraries/core/config/ConfigFile.h	(revision 9559)
+++ code/branches/core6/src/libraries/core/config/ConfigFile.h	(revision 9559)
@@ -0,0 +1,178 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @ingroup Config ConfigFile
+*/
+
+#ifndef _ConfigFile_H__
+#define _ConfigFile_H__
+
+#include "core/CorePrereqs.h"
+
+#include "ConfigFileSection.h"
+
+namespace orxonox
+{
+    ////////////////
+    // ConfigFile //
+    ////////////////
+    /**
+        @brief This class represents a config file, which is stored on the hard-disk and contains config values in different sections.
+
+        It provides an interface to manipulate the sections and values.
+    */
+    class _CoreExport ConfigFile
+    {
+        public:
+            ConfigFile(const std::string& filename, bool bCopyFallbackFile = true);
+            virtual ~ConfigFile();
+
+            virtual void load();
+            virtual void save() const;
+            virtual void saveAs(const std::string& filename) const;
+            virtual void clear();
+
+            /// Returns the file-name of this config file
+            inline const std::string& getFilename()
+                { return this->filename_; }
+
+            /**
+                @brief Stores a value in the config file. If the entry or its section doesn't exist, it's created.
+
+                @param section  The name of the section
+                @param name     The name of the entry
+                @param value    The new value
+                @param bString  If true, the value is treated as string which means some special treatment of special characters.
+            */
+            inline void setValue(const std::string& section, const std::string& name, const std::string& value, bool bString)
+            {
+                this->getOrCreateSection(section)->setValue(name, value, bString);
+                this->save();
+            }
+            /**
+                @brief Returns the value of a given entry in the config file. Returns a blank string if the value doesn't exist.
+
+                @param section  The name of the section
+                @param name     The name of the entry
+                @param bString  If true, the value is treated as string which means some special treatment of special characters.
+            */
+            inline const std::string& getValue(const std::string& section, const std::string& name, bool bString)
+            {
+                ConfigFileSection* sectionPtr = this->getSection(section);
+                return (sectionPtr ? sectionPtr->getValue(name, bString) : BLANKSTRING);
+            }
+            /**
+                @brief Returns the value of a given entry in the config file. If it doesn't exist, the entry is created using the fallback value.
+
+                @param section  The name of the section
+                @param name     The name of the entry
+                @param fallback The value that will be used if the entry doesn't exist
+                @param bString  If true, the value is treated as string which means some special treatment of special characters.
+            */
+            inline const std::string& getOrCreateValue(const std::string& section, const std::string& name, const std::string& fallback, bool bString)
+            {
+                const std::string& output = this->getOrCreateSection(section)->getOrCreateValue(name, fallback, bString);
+                this->saveIfUpdated();
+                return output;
+            }
+
+            /**
+                @brief Stores the value of an element of a vector in the config file. If the entry or its section doesn't exist, it's created.
+
+                @param section  The name of the section
+                @param name     The name of the vector
+                @param index    The index of the element in the vector
+                @param value    The new value
+                @param bString  If true, the value is treated as string which means some special treatment of special characters.
+            */
+            inline void setValue(const std::string& section, const std::string& name, unsigned int index, const std::string& value, bool bString)
+            {
+                this->getOrCreateSection(section)->setValue(name, index, value, bString);
+                this->save();
+            }
+            /**
+                @brief Returns the value of a given element of a vector in the config file. Returns a blank string if the value doesn't exist.
+
+                @param section  The name of the section
+                @param name     The name of the vector
+                @param index    The index of the element in the vector
+                @param bString  If true, the value is treated as string which means some special treatment of special characters.
+            */
+            inline const std::string& getValue(const std::string& section, const std::string& name, unsigned int index, bool bString)
+            {
+                ConfigFileSection* sectionPtr = this->getSection(section);
+                return (sectionPtr ? sectionPtr->getValue(name, index, bString) : BLANKSTRING);
+            }
+            /**
+                @brief Returns the value of a given element of a vector in the config file. If it doesn't exist, the entry is created using the fallback value.
+
+                @param section  The name of the section
+                @param name     The name of the vector
+                @param index    The index of the element in the vector
+                @param fallback The value that will be used if the entry doesn't exist
+                @param bString  If true, the value is treated as string which means some special treatment of special characters.
+            */
+            const std::string& getOrCreateValue(const std::string& section, const std::string& name, unsigned int index, const std::string& fallback, bool bString)
+            {
+                const std::string& output = this->getOrCreateSection(section)->getOrCreateValue(name, index, fallback, bString);
+                this->saveIfUpdated();
+                return output;
+            }
+
+            void deleteVectorEntries(const std::string& section, const std::string& name, unsigned int startindex = 0);
+            /**
+                @brief Returns the size of a config vector.
+                @param section  The section of the vector
+                @param name     The name of the vector
+            */
+            inline unsigned int getVectorSize(const std::string& section, const std::string& name) const
+            {
+                ConfigFileSection* sectionPtr = this->getSection(section);
+                return (sectionPtr ? sectionPtr->getVectorSize(name) : 0);
+            }
+
+            static const char* DEFAULT_CONFIG_FOLDER;   ///< The folder where the default config files will be stored
+
+        protected:
+            ConfigFileSection* getSection(const std::string& section) const;
+            ConfigFileSection* getOrCreateSection(const std::string& section);
+
+            std::list<ConfigFileSection*> sections_;    ///< A list of sections in this config file
+
+        private:
+            void saveIfUpdated();
+
+            const std::string filename_;                ///< The filename of this config file
+            const bool bCopyFallbackFile_;              ///< If true, the default config file is copied into the config-directory before loading the file
+            bool bUpdated_;                             ///< Becomes true if a section is added
+    };
+}
+
+#endif /* _ConfigFile_H__ */
Index: code/branches/core6/src/libraries/core/config/ConfigFileEntry.h
===================================================================
--- code/branches/core6/src/libraries/core/config/ConfigFileEntry.h	(revision 9559)
+++ code/branches/core6/src/libraries/core/config/ConfigFileEntry.h	(revision 9559)
@@ -0,0 +1,77 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @ingroup Config ConfigFile
+*/
+
+#ifndef _ConfigFileEntry_H__
+#define _ConfigFileEntry_H__
+
+#include "core/CorePrereqs.h"
+
+namespace orxonox
+{
+    /////////////////////
+    // ConfigFileEntry //
+    /////////////////////
+    /**
+        @brief This class represents an entry in the config file.
+
+        This class is pure virtual. Use one of the derived classes to define the type of the entry.
+    */
+    class _CoreExport ConfigFileEntry
+    {
+        public:
+            /// Destructor
+            virtual ~ConfigFileEntry() {};
+
+            /// Changes the value of the entry.
+            virtual void setValue(const std::string& value) = 0;
+            /// Returns the value of the entry.
+            virtual const std::string& getValue() const = 0;
+
+            /// Returns the name of the entry
+            virtual const std::string& getName() const = 0;
+
+            /// Changes the comment of the entry (will be placed after the value)
+            virtual void setComment(const std::string& comment) = 0;
+
+            /// Returns the index of the entry in a vector (used only if it is a vector)
+            virtual unsigned int getIndex() const { return 0; }
+
+            /// Defines if this entry is treated as string which means some special treatment of special characters.
+            virtual void setString(bool bString) = 0;
+
+            /// Returns the line as it will be stored in the config file.
+            virtual const std::string& getFileEntry() const = 0;
+    };
+}
+
+#endif /* _ConfigFileEntry_H__ */
Index: code/branches/core6/src/libraries/core/config/ConfigFileEntryComment.h
===================================================================
--- code/branches/core6/src/libraries/core/config/ConfigFileEntryComment.h	(revision 9559)
+++ code/branches/core6/src/libraries/core/config/ConfigFileEntryComment.h	(revision 9559)
@@ -0,0 +1,80 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @ingroup Config ConfigFile
+*/
+
+#ifndef _ConfigFileEntryComment_H__
+#define _ConfigFileEntryComment_H__
+
+#include "core/CorePrereqs.h"
+
+#include "ConfigFileEntry.h"
+
+namespace orxonox
+{
+    ////////////////////////////
+    // ConfigFileEntryComment //
+    ////////////////////////////
+    /**
+        @brief This class represents a line in the config file which contains only a comment.
+    */
+    class _CoreExport ConfigFileEntryComment : public ConfigFileEntry
+    {
+        public:
+            /// Constructor: Initializes the object.
+            inline ConfigFileEntryComment(const std::string& comment) : comment_(comment) {}
+
+            /// Destructor
+            inline virtual ~ConfigFileEntryComment() {}
+
+            inline virtual const std::string& getName() const
+                { return this->comment_; }
+
+            inline virtual void setComment(const std::string& comment)
+                { this->comment_ = comment; }
+
+            inline virtual void setValue(const std::string& value)
+                {}
+            inline virtual const std::string& getValue() const
+                { return BLANKSTRING; }
+
+            inline void setString(bool bString)
+                {}
+
+            inline virtual const std::string& getFileEntry() const
+                { return this->comment_; }
+
+        private:
+            std::string comment_;   ///< The comment
+    };
+}
+
+#endif /* _ConfigFileEntryComment_H__ */
Index: code/branches/core6/src/libraries/core/config/ConfigFileEntryValue.cc
===================================================================
--- code/branches/core6/src/libraries/core/config/ConfigFileEntryValue.cc	(revision 9559)
+++ code/branches/core6/src/libraries/core/config/ConfigFileEntryValue.cc	(revision 9559)
@@ -0,0 +1,60 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of ConfigFileEntryValue.
+*/
+
+#include "ConfigFileEntryValue.h"
+
+#include "util/StringUtils.h"
+
+namespace orxonox
+{
+    //////////////////////////
+    // ConfigFileEntryValue //
+    //////////////////////////
+    /**
+        @brief Updates the string that will be stored in the file after one of it's components (name, value, comment) has changed.
+    */
+    void ConfigFileEntryValue::update()
+    {
+        // Make sure we remove the quotes when bString changes
+        if (this->bString_)
+            this->value_ = stripEnclosingQuotes(this->value_);
+        // Assemble the entry line
+        this->fileEntry_ = this->getKeyString() + " = ";
+        if (this->bString_ && !this->value_.empty())
+            this->fileEntry_ += '"' + addSlashes(this->value_) + '"';
+        else
+            this->fileEntry_ += this->value_;
+        if (!this->additionalComment_.empty())
+            this->fileEntry_ += ' ' + this->additionalComment_;
+    }
+}
Index: code/branches/core6/src/libraries/core/config/ConfigFileEntryValue.h
===================================================================
--- code/branches/core6/src/libraries/core/config/ConfigFileEntryValue.h	(revision 9559)
+++ code/branches/core6/src/libraries/core/config/ConfigFileEntryValue.h	(revision 9559)
@@ -0,0 +1,102 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @ingroup Config ConfigFile
+*/
+
+#ifndef _ConfigFileEntryValue_H__
+#define _ConfigFileEntryValue_H__
+
+#include "core/CorePrereqs.h"
+
+#include "ConfigFileEntry.h"
+
+namespace orxonox
+{
+    //////////////////////////
+    // ConfigFileEntryValue //
+    //////////////////////////
+    /**
+        @brief This class represents a normal value in the config file.
+    */
+    class _CoreExport ConfigFileEntryValue : public ConfigFileEntry
+    {
+        public:
+            /**
+                @brief Constructor: Initializes the entry.
+
+                @param name                 The name of the entry
+                @param value                The value of the entry
+                @param bString              If true, the value is treated as string which means some special treatment of special characters.
+                @param additionalComment    An optional comment that will be placed behind the value in the config file
+            */
+            inline ConfigFileEntryValue(const std::string& name, const std::string& value = "", bool bString = false, const std::string& additionalComment = "")
+                : name_(name)
+                , value_(value)
+                , additionalComment_(additionalComment)
+                , bString_(bString)
+                { this->update(); }
+
+            /// Destructor
+            inline virtual ~ConfigFileEntryValue() {}
+
+            inline virtual const std::string& getName() const
+                { return this->name_; }
+
+            inline virtual void setComment(const std::string& comment)
+                { this->additionalComment_ = comment; this->update(); }
+
+            inline virtual void setValue(const std::string& value)
+                { this->value_ = value; this->update(); }
+            inline virtual const std::string& getValue() const
+                { return this->value_; }
+
+            inline void virtual setString(bool bString)
+                { this->bString_ = bString; this->update(); }
+
+            inline virtual const std::string& getFileEntry() const
+                { return this->fileEntry_; }
+
+            /// Returns the "key" of the value (in this case it's just the name of the entry, but for vectors it's different)
+            inline virtual const std::string& getKeyString() const
+                { return this->name_; }
+
+        protected:
+            virtual void update();
+
+            const std::string name_;            ///< The name of the value
+            std::string value_;                 ///< The value
+            std::string additionalComment_;     ///< The additional comment
+            std::string fileEntry_;             ///< The string as it will be stored in the config file
+            bool bString_;                      ///< If true, the value is treated as string which means some special treatment of special characters.
+    };
+}
+
+#endif /* _ConfigFileEntryValue_H__ */
Index: code/branches/core6/src/libraries/core/config/ConfigFileEntryVectorValue.cc
===================================================================
--- code/branches/core6/src/libraries/core/config/ConfigFileEntryVectorValue.cc	(revision 9559)
+++ code/branches/core6/src/libraries/core/config/ConfigFileEntryVectorValue.cc	(revision 9559)
@@ -0,0 +1,51 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of ConfigFileEntryVectorValue.
+*/
+
+#include "ConfigFileEntryVectorValue.h"
+
+#include "util/Convert.h"
+
+namespace orxonox
+{
+    ////////////////////////////////
+    // ConfigFileEntryVectorValue //
+    ////////////////////////////////
+    /**
+        @brief Updates the string that will be stored in the file after one of it's components (name, value, index, comment) has changed.
+    */
+    void ConfigFileEntryVectorValue::update()
+    {
+        this->keyString_ = this->name_ + '[' + multi_cast<std::string>(this->index_) + ']';
+        ConfigFileEntryValue::update();
+    }
+}
Index: code/branches/core6/src/libraries/core/config/ConfigFileEntryVectorValue.h
===================================================================
--- code/branches/core6/src/libraries/core/config/ConfigFileEntryVectorValue.h	(revision 9559)
+++ code/branches/core6/src/libraries/core/config/ConfigFileEntryVectorValue.h	(revision 9559)
@@ -0,0 +1,84 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @ingroup Config ConfigFile
+*/
+
+#ifndef _ConfigFileEntryVectorValue_H__
+#define _ConfigFileEntryVectorValue_H__
+
+#include "core/CorePrereqs.h"
+
+#include "ConfigFileEntryValue.h"
+
+namespace orxonox
+{
+    ////////////////////////////////
+    // ConfigFileEntryVectorValue //
+    ////////////////////////////////
+    /**
+        @brief Subclass of ConfigFileEntryValue, represents an element of a vector.
+    */
+    class _CoreExport ConfigFileEntryVectorValue : public ConfigFileEntryValue
+    {
+        public:
+            /**
+                @brief Constructor: Initializes the entry.
+
+                @param name                 The name of the vector
+                @param index                The index of the element in the vector
+                @param value                The value of the element
+                @param bString              If true, the value is treated as string which means some special treatment of special characters.
+                @param additionalComment    An optional comment that will be placed behind the value in the config file
+            */
+            inline ConfigFileEntryVectorValue(const std::string& name, unsigned int index, const std::string& value = "", bool bString = false, const std::string& additionalComment = "")
+                : ConfigFileEntryValue(name, value, bString, additionalComment)
+                , index_(index)
+                { this->update(); /*No virtual calls in base class ctor*/ }
+
+            /// Destructor
+            inline ~ConfigFileEntryVectorValue() {}
+
+            inline unsigned int getIndex() const
+                { return this->index_; }
+
+            /// Returns the "key" of the value (the name of the vector plus the index of the element)
+            inline const std::string& getKeyString() const
+                { return this->keyString_; }
+
+        private:
+            void update();
+
+            unsigned int index_;        ///< The index of the element in the vector
+            std::string keyString_;     ///< The full name of the entry (the name of the vector plus the index of the element)
+    };
+}
+
+#endif /* _ConfigFileEntryVectorValue_H__ */
Index: code/branches/core6/src/libraries/core/config/ConfigFileManager.cc
===================================================================
--- code/branches/core6/src/libraries/core/config/ConfigFileManager.cc	(revision 9558)
+++ code/branches/core6/src/libraries/core/config/ConfigFileManager.cc	(revision 9559)
@@ -29,706 +29,13 @@
 /**
     @file
-    @brief Implementation of ConfigFileManager and its helper classes.
+    @brief Implementation of ConfigFileManager.
 */
 
 #include "ConfigFileManager.h"
 
-#include <boost/filesystem.hpp>
-
-#include "util/Convert.h"
-#include "util/Math.h"
-#include "util/StringUtils.h"
-#include "core/PathConfig.h"
-#include "core/command/ConsoleCommand.h"
-#include "ConfigValueContainer.h"
+#include "SettingsConfigFile.h"
 
 namespace orxonox
 {
-    //////////////////////////
-    // ConfigFileEntryValue //
-    //////////////////////////
-    /**
-        @brief Updates the string that will be stored in the file after one of it's components (name, value, comment) has changed.
-    */
-    void ConfigFileEntryValue::update()
-    {
-        // Make sure we remove the quotes when bString changes
-        if (this->bString_)
-            this->value_ = stripEnclosingQuotes(this->value_);
-        // Assemble the entry line
-        this->fileEntry_ = this->getKeyString() + " = ";
-        if (this->bString_ && !this->value_.empty())
-            this->fileEntry_ += '"' + addSlashes(this->value_) + '"';
-        else
-            this->fileEntry_ += this->value_;
-        if (!this->additionalComment_.empty())
-            this->fileEntry_ += ' ' + this->additionalComment_;
-    }
-
-
-    ////////////////////////////////
-    // ConfigFileEntryVectorValue //
-    ////////////////////////////////
-    /**
-        @brief Updates the string that will be stored in the file after one of it's components (name, value, index, comment) has changed.
-    */
-    void ConfigFileEntryVectorValue::update()
-    {
-        this->keyString_ = this->name_ + '[' + multi_cast<std::string>(this->index_) + ']';
-        ConfigFileEntryValue::update();
-    }
-
-
-    ///////////////////////
-    // ConfigFileSection //
-    ///////////////////////
-    /**
-        @brief Destructor: Deletes all entries.
-    */
-    ConfigFileSection::~ConfigFileSection()
-    {
-        for (std::list<ConfigFileEntry*>::iterator it = this->entries_.begin(); it != this->entries_.end(); )
-            delete (*(it++));
-    }
-
-    /**
-        @brief Deletes all elements of a config vector if their index is greater or equal to @a startindex.
-
-        @param name         The name of the vector
-        @param startindex   The index of the first element that will be deleted
-    */
-    void ConfigFileSection::deleteVectorEntries(const std::string& name, unsigned int startindex)
-    {
-        for (std::list<ConfigFileEntry*>::iterator it = this->entries_.begin(); it != this->entries_.end(); )
-        {
-            if (((*it)->getName() == name) && ((*it)->getIndex() >= startindex))
-            {
-                delete (*it);
-                this->entries_.erase(it++);
-            }
-            else
-            {
-                ++it;
-            }
-        }
-    }
-
-    /**
-        @brief Returns the size of a config vector.
-        @param name     The name of the vector
-    */
-    unsigned int ConfigFileSection::getVectorSize(const std::string& name) const
-    {
-        unsigned int size = 0;
-        for (std::list<ConfigFileEntry*>::const_iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
-            if ((*it)->getName() == name)
-                if ((*it)->getIndex() >= size)
-                    size = (*it)->getIndex() + 1;
-        return size;
-    }
-
-    /**
-        @brief Returns the title and comment of the section as it will be stored in the file.
-    */
-    std::string ConfigFileSection::getFileEntry() const
-    {
-        if (this->additionalComment_.empty())
-            return ('[' + this->name_ + ']');
-        else
-            return ('[' + this->name_ + "] " + this->additionalComment_);
-    }
-
-    /**
-        @brief Returns the entry with given name (or NULL if it doesn't exist).
-
-        @param name     The name of the entry
-    */
-    ConfigFileEntry* ConfigFileSection::getEntry(const std::string& name) const
-    {
-        for (std::list<ConfigFileEntry*>::const_iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
-        {
-            if ((*it)->getName() == name)
-                return *it;
-        }
-        return NULL;
-    }
-
-    /**
-        @brief Returns the entry of a vector element with given name and index (or NULL if it doesn't exist).
-
-        @param name     The name of the vector
-        @param index    The index of the element in the vector
-    */
-    ConfigFileEntry* ConfigFileSection::getEntry(const std::string& name, unsigned int index) const
-    {
-        for (std::list<ConfigFileEntry*>::const_iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
-        {
-            if (((*it)->getName() == name) && ((*it)->getIndex() == index))
-                return *it;
-        }
-        return NULL;
-    }
-
-    /**
-        @brief Returns the iterator to the entry with given name. If the entry doesn't exist, it is created using the fallback value.
-
-        @param name     The name of the entry
-        @param fallback The value that will be used if the entry doesn't exist
-        @param bString  If true, the value is treated as string which means some special treatment of special characters.
-    */
-    std::list<ConfigFileEntry*>::iterator ConfigFileSection::getOrCreateEntryIterator(const std::string& name, const std::string& fallback, bool bString)
-    {
-        for (std::list<ConfigFileEntry*>::iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
-        {
-            if ((*it)->getName() == name)
-            {
-                (*it)->setString(bString);
-                return it;
-            }
-        }
-
-        this->bUpdated_ = true;
-
-        return this->entries_.insert(this->entries_.end(), new ConfigFileEntryValue(name, fallback, bString));
-    }
-
-    /**
-        @brief Returns the iterator to the entry of a vector element with given name and index. If the entry doesn't exist, it is created using the fallback value.
-
-        @param name     The name of the vector
-        @param index    The index of the element in the vector
-        @param fallback The value that will be used if the entry doesn't exist
-        @param bString  If true, the value is treated as string which means some special treatment of special characters.
-    */
-    std::list<ConfigFileEntry*>::iterator ConfigFileSection::getOrCreateEntryIterator(const std::string& name, unsigned int index, const std::string& fallback, bool bString)
-    {
-        for (std::list<ConfigFileEntry*>::iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
-        {
-            if (((*it)->getName() == name) && ((*it)->getIndex() == index))
-            {
-                (*it)->setString(bString);
-                return it;
-            }
-        }
-
-        this->bUpdated_ = true;
-
-        if (index == 0)
-            return this->entries_.insert(this->entries_.end(), new ConfigFileEntryVectorValue(name, index, fallback, bString));
-        else
-            return this->entries_.insert(++this->getOrCreateEntryIterator(name, index - 1, "", bString), new ConfigFileEntryVectorValue(name, index, fallback, bString));
-    }
-
-
-    ////////////////
-    // ConfigFile //
-    ////////////////
-
-    const char* ConfigFile::DEFAULT_CONFIG_FOLDER = "defaultConfig";
-
-    /**
-        @brief Constructor: Initializes the config file.
-        @param filename The file-name of this config file
-        @param bCopyFallbackFile If true, the default config file is copied into the config-directory before loading the file
-    */
-    ConfigFile::ConfigFile(const std::string& filename, bool bCopyFallbackFile)
-        : filename_(filename)
-        , bCopyFallbackFile_(bCopyFallbackFile)
-        , bUpdated_(false)
-    {
-    }
-
-    /**
-        @brief Destructor: Deletes all sections and entries.
-    */
-    ConfigFile::~ConfigFile()
-    {
-        this->clear();
-    }
-
-    /**
-        @brief Loads the config file from the hard-disk and reads the sections and their values.
-    */
-    void ConfigFile::load()
-    {
-        // Be sure we start from new in the memory
-        this->clear();
-
-        boost::filesystem::path filepath(this->filename_);
-        if (!filepath.is_complete())
-        {
-            filepath = PathConfig::getConfigPath() / filepath;
-            if (this->bCopyFallbackFile_)
-            {
-                // Look for default file in the data folder
-                if (!boost::filesystem::exists(filepath))
-                {
-                    boost::filesystem::path defaultFilepath(PathConfig::getDataPath() / DEFAULT_CONFIG_FOLDER / this->filename_);
-                    if (boost::filesystem::exists(defaultFilepath))
-                    {
-                        // Try to copy default file from the data folder
-                        try
-                        {
-                            boost::filesystem::copy_file(defaultFilepath, filepath);
-                            orxout(internal_info, context::config) << "Copied " << this->filename_ << " from the default config folder." << endl;
-                        }
-                        catch (const boost::filesystem::filesystem_error& ex)
-                        { orxout(user_error, context::config) << "Error in ConfigFile: " << ex.what() << endl; }
-                    }
-                }
-            }
-        }
-
-        // Open the file
-        std::ifstream file;
-        file.open(filepath.string().c_str(), std::fstream::in);
-        if (file.is_open())
-        {
-            ConfigFileSection* newsection = 0;
-
-            while (file.good() && !file.eof())
-            {
-                std::string line;
-                std::getline(file, line);
-
-                const std::string& temp = getStripped(line);
-                if (!isEmpty(temp) && !isComment(temp))
-                {
-                    size_t   pos1 = temp.find('[');
-                    if (pos1 == 0) pos1 = line.find('['); else pos1 = std::string::npos;
-                    size_t   pos2 = line.find(']');
-
-                    if (pos1 != std::string::npos && pos2 != std::string::npos && pos2 > pos1 + 1)
-                    {
-                        // New section
-                        const std::string& comment = line.substr(pos2 + 1);
-                        if (isComment(comment))
-                            newsection = new ConfigFileSection(line.substr(pos1 + 1, pos2 - pos1 - 1), comment);
-                        else
-                            newsection = new ConfigFileSection(line.substr(pos1 + 1, pos2 - pos1 - 1));
-                        this->sections_.insert(this->sections_.end(), newsection);
-                        continue;
-                    }
-                }
-
-                if (newsection != 0)
-                {
-                    if (isComment(line))
-                    {
-                        // New comment
-                        newsection->getEntries().insert(newsection->getEntries().end(), new ConfigFileEntryComment(removeTrailingWhitespaces(line)));
-                        continue;
-                    }
-                    else
-                    {
-                        size_t pos1 = line.find('=');
-
-                        if (pos1 != std::string::npos && pos1 > 0)
-                        {
-                            // New entry
-                            size_t pos2 = line.find('[');
-                            size_t pos3 = line.find(']');
-                            size_t commentposition = getNextCommentPosition(line, pos1 + 1);
-                            while (isBetweenQuotes(line, commentposition))
-                            {
-                                commentposition = getNextCommentPosition(line, commentposition + 1);
-                            }
-                            std::string value, comment;
-                            if (commentposition == std::string::npos)
-                            {
-                                value = line.substr(pos1 + 1);
-                            }
-                            else
-                            {
-                                value = line.substr(pos1 + 1, commentposition - pos1 - 1);
-                                comment = removeTrailingWhitespaces(line.substr(commentposition));
-                            }
-
-                            value = removeTrailingWhitespaces(value);
-                            value = removeSlashes(value);
-
-                            if (pos2 != std::string::npos && pos3 != std::string::npos && pos3 > pos2 + 1)
-                            {
-                                // There might be an array index
-                                unsigned int index = 0;
-                                if (convertValue(&index, line.substr(pos2 + 1, pos3 - pos2 - 1)))
-                                {
-                                    // New array
-                                    std::list<ConfigFileEntry*>::iterator it = newsection->getOrCreateEntryIterator(getStripped(line.substr(0, pos2)), index, value, false);
-                                    (*it)->setValue(value);
-                                    (*it)->setComment(comment);
-                                    continue;
-                                }
-                            }
-
-                            // New value
-                            newsection->getEntries().insert(newsection->getEntries().end(), new ConfigFileEntryValue(getStripped(line.substr(0, pos1)), value, false, comment));
-                            continue;
-                        }
-                    }
-                }
-            }
-
-            file.close();
-
-            orxout(internal_info, context::config) << "Loaded config file \"" << this->filename_ << "\"." << endl;
-
-            // DO NOT save the file --> we can open supposedly read only config files
-        } // end file.is_open()
-    }
-
-    /**
-        @brief Writes the sections and values to the hard-disk.
-    */
-    void ConfigFile::save() const
-    {
-        this->saveAs(this->filename_);
-    }
-
-    /**
-        @brief Writes the sections and values to a given file on the hard-disk.
-    */
-    void ConfigFile::saveAs(const std::string& filename) const
-    {
-        boost::filesystem::path filepath(filename);
-        if (!filepath.is_complete())
-            filepath = PathConfig::getConfigPath() / filename;
-        std::ofstream file;
-        file.open(filepath.string().c_str(), std::fstream::out);
-        file.setf(std::ios::fixed, std::ios::floatfield);
-        file.precision(6);
-
-        if (!file.is_open())
-        {
-            orxout(user_error, context::config) << "Couldn't open config-file \"" << filename << "\"." << endl;
-            return;
-        }
-
-        for (std::list<ConfigFileSection*>::const_iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
-        {
-            file << (*it)->getFileEntry() << endl;
-
-            for (std::list<ConfigFileEntry*>::const_iterator it_entries = (*it)->getEntriesBegin(); it_entries != (*it)->getEntriesEnd(); ++it_entries)
-                file << (*it_entries)->getFileEntry() << endl;
-
-            file << endl;
-        }
-
-        file.close();
-
-        orxout(verbose, context::config) << "Saved config file \"" << filename << "\"." << endl;
-    }
-
-    /**
-        @brief Deletes all sections (which again delete all their values) and clears the list of sections.
-    */
-    void ConfigFile::clear()
-    {
-        for (std::list<ConfigFileSection*>::iterator it = this->sections_.begin(); it != this->sections_.end(); )
-            delete (*(it++));
-        this->sections_.clear();
-    }
-
-    /**
-        @brief Deletes all elements of a config vector if their index is greater or equal to @a startindex.
-
-        @param section      The name of the section
-        @param name         The name of the vector
-        @param startindex   The index of the first element that will be deleted
-    */
-    void ConfigFile::deleteVectorEntries(const std::string& section, const std::string& name, unsigned int startindex)
-    {
-        if (ConfigFileSection* sectionPtr = this->getSection(section))
-        {
-            sectionPtr->deleteVectorEntries(name, startindex);
-            this->save();
-        }
-    }
-
-    /**
-        @brief Returns a pointer to the section with given name (or NULL if the section doesn't exist).
-    */
-    ConfigFileSection* ConfigFile::getSection(const std::string& section) const
-    {
-        for (std::list<ConfigFileSection*>::const_iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
-            if ((*it)->getName() == section)
-                return (*it);
-        return NULL;
-    }
-
-    /**
-        @brief Returns a pointer to the section with given name. If it doesn't exist, the section is created.
-    */
-    ConfigFileSection* ConfigFile::getOrCreateSection(const std::string& section)
-    {
-        for (std::list<ConfigFileSection*>::iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
-            if ((*it)->getName() == section)
-                return (*it);
-
-        this->bUpdated_ = true;
-
-        return (*this->sections_.insert(this->sections_.end(), new ConfigFileSection(section)));
-    }
-
-    /**
-        @brief Saves the config file if it was updated (or if any of its sections were updated).
-    */
-    void ConfigFile::saveIfUpdated()
-    {
-        bool sectionsUpdated = false;
-
-        for (std::list<ConfigFileSection*>::iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
-        {
-            if ((*it)->bUpdated_)
-            {
-                sectionsUpdated = true;
-                (*it)->bUpdated_ = false;
-            }
-        }
-
-        if (this->bUpdated_ || sectionsUpdated)
-        {
-            this->bUpdated_ = false;
-            this->save();
-        }
-    }
-
-
-    ////////////////////////
-    // SettingsConfigFile //
-    ////////////////////////
-
-    static const std::string __CC_load_name = "reloadSettings";
-    static const std::string __CC_setFilename_name = "setSettingsFile";
-    static const std::string __CC_config_name = "config";
-    static const std::string __CC_tconfig_name = "tconfig";
-    static const std::string __CC_getConfig_name = "getConfig";
-
-    SetConsoleCommand(__CC_load_name,            &ConfigFile::load);
-    SetConsoleCommand(__CC_setFilename_name,     &SettingsConfigFile::setFilename);
-    SetConsoleCommand(__CC_config_name,          &SettingsConfigFile::config).argumentCompleter(0, autocompletion::settingssections()).argumentCompleter(1, autocompletion::settingsentries()).argumentCompleter(2, autocompletion::settingsvalue());
-    SetConsoleCommand(__CC_tconfig_name,         &SettingsConfigFile::tconfig).argumentCompleter(0, autocompletion::settingssections()).argumentCompleter(1, autocompletion::settingsentries()).argumentCompleter(2, autocompletion::settingsvalue());
-    SetConsoleCommand(__CC_getConfig_name,       &SettingsConfigFile::getConfig).argumentCompleter(0, autocompletion::settingssections()).argumentCompleter(1, autocompletion::settingsentries());
-
-    SettingsConfigFile* SettingsConfigFile::singletonPtr_s = 0;
-
-    /**
-        @brief Constructor: Activates the console commands.
-    */
-    SettingsConfigFile::SettingsConfigFile(const std::string& filename)
-        : ConfigFile(filename)
-    {
-        ModifyConsoleCommand(__CC_load_name).setObject(this);
-        ModifyConsoleCommand(__CC_setFilename_name).setObject(this);
-        ModifyConsoleCommand(__CC_config_name).setObject(this);
-        ModifyConsoleCommand(__CC_tconfig_name).setObject(this);
-        ModifyConsoleCommand(__CC_getConfig_name).setObject(this);
-    }
-
-    /**
-        @brief Destructor: Deactivates the console commands.
-    */
-    SettingsConfigFile::~SettingsConfigFile()
-    {
-        ModifyConsoleCommand(__CC_load_name).setObject(0);
-        ModifyConsoleCommand(__CC_setFilename_name).setObject(0);
-        ModifyConsoleCommand(__CC_config_name).setObject(0);
-        ModifyConsoleCommand(__CC_tconfig_name).setObject(0);
-        ModifyConsoleCommand(__CC_getConfig_name).setObject(0);
-    }
-
-    /**
-        @brief Loads the config file and updates the @ref ConfigValueContainer "config value containers".
-    */
-    void SettingsConfigFile::load()
-    {
-        ConfigFile::load();
-        this->updateConfigValues();
-    }
-
-    /**
-        @brief Changes the file-name.
-    */
-    void SettingsConfigFile::setFilename(const std::string& filename)
-    {
-        ConfigFileManager::getInstance().setFilename(ConfigFileType::Settings, filename);
-    }
-
-    /**
-        @brief Registers a new @ref ConfigValueContainer "config value container".
-    */
-    void SettingsConfigFile::addConfigValueContainer(ConfigValueContainer* container)
-    {
-        if (container == NULL)
-            return;
-        std::pair<std::string, ConfigValueContainer*> second(getLowercase(container->getName()), container);
-        this->containers_.insert(std::make_pair(getLowercase(container->getSectionName()), second));
-        this->sectionNames_.insert(container->getSectionName());
-    }
-
-    /**
-        @brief Unregisters a @ref ConfigValueContainer "config value container".
-    */
-    void SettingsConfigFile::removeConfigValueContainer(ConfigValueContainer* container)
-    {
-        if (container == NULL)
-            return;
-        const std::string& sectionLC = getLowercase(container->getSectionName());
-        ContainerMap::iterator upper = this->containers_.upper_bound(sectionLC);
-        for (ContainerMap::iterator it = this->containers_.lower_bound(sectionLC); it != upper; ++it)
-        {
-            if (it->second.second == container)
-            {
-                // Remove entry from section name set this was the last container for that section
-                if (upper == this->containers_.lower_bound(sectionLC))
-                    this->sectionNames_.erase(container->getSectionName());
-                this->containers_.erase(it);
-                break;
-            }
-        }
-    }
-
-    /**
-        @brief Updates all @ref ConfigValueContainer "config value containers".
-    */
-    void SettingsConfigFile::updateConfigValues()
-    {
-        // todo: can this be done more efficiently? looks like some identifiers will be updated multiple times.
-
-        for (ContainerMap::const_iterator it = this->containers_.begin(); it != this->containers_.end(); ++it)
-        {
-            it->second.second->update();
-            it->second.second->getIdentifier()->updateConfigValues();
-        }
-    }
-
-    /**
-        @brief Removes entries and sections from the file that don't exist anymore (i.e. if there's no corresponding @ref ConfigValueContainer "config value container").
-        @param bCleanComments If true, comments are also removed from the file
-    */
-    void SettingsConfigFile::clean(bool bCleanComments)
-    {
-        for (std::list<ConfigFileSection*>::iterator itSection = this->sections_.begin(); itSection != this->sections_.end(); )
-        {
-            const std::string& sectionLC = getLowercase((*itSection)->getName());
-            ContainerMap::const_iterator lower = this->containers_.lower_bound(sectionLC);
-            ContainerMap::const_iterator upper = this->containers_.upper_bound(sectionLC);
-            if (lower != upper)
-            {
-                // The section exists, delete comment
-                if (bCleanComments)
-                    (*itSection)->setComment("");
-                for (std::list<ConfigFileEntry*>::iterator itEntry = (*itSection)->entries_.begin(); itEntry != (*itSection)->entries_.end(); )
-                {
-                    const std::string& entryLC = getLowercase((*itEntry)->getName());
-                    bool bFound = false;
-                    for (ContainerMap::const_iterator itContainer = lower; itContainer != upper; ++itContainer)
-                    {
-                        if (itContainer->second.first == entryLC)
-                        {
-                            // The config-value exists, delete comment
-                            if (bCleanComments)
-                                (*itEntry)->setComment("");
-                            ++itEntry;
-                            bFound = true;
-                            break;
-                        }
-                    }
-                    if (!bFound)
-                    {
-                        // The config-value doesn't exist
-                        delete (*itEntry);
-                        (*itSection)->entries_.erase(itEntry++);
-                    }
-                }
-                ++itSection;
-            }
-            else
-            {
-                // The section doesn't exist
-                delete (*itSection);
-                this->sections_.erase(itSection++);
-            }
-        }
-
-        // Save the file
-        this->save();
-    }
-
-    /**
-        @brief Console-command: Changes the value of an entry and stores it the file.
-
-        @param section  The section of the config value
-        @param entry    The name of the config value
-        @param value    The new value
-    */
-    void SettingsConfigFile::config(const std::string& section, const std::string& entry, const std::string& value)
-    {
-        if (!this->configImpl(section, entry, value, &ConfigValueContainer::set))
-            orxout(user_error, context::config) << "Config value \"" << entry << "\" in section \"" << section << "\" doesn't exist." << endl;
-    }
-
-    /**
-        @brief Console-command: Changes the value of an entry, but doesn't store it in the file (it's only a temporary change).
-
-        @param section  The section of the config value
-        @param entry    The name of the config value
-        @param value    The new value
-    */
-    void SettingsConfigFile::tconfig(const std::string& section, const std::string& entry, const std::string& value)
-    {
-        if (!this->configImpl(section, entry, value, &ConfigValueContainer::tset))
-            orxout(user_error, context::config) << "Config value \"" << entry << "\" in section \"" << section << "\" doesn't exist." << endl;
-    }
-
-    /**
-        @brief Changes the value of an entry, depending on @a function, either by using "set" or "tset"
-
-        @param section  The section of the config value
-        @param entry    The name of the config value
-        @param value    The new value
-        @param function The function ("set" or "tset") that will be used to change the value.
-    */
-    bool SettingsConfigFile::configImpl(const std::string& section, const std::string& entry, const std::string& value, bool (ConfigValueContainer::*function)(const MultiType&))
-    {
-        const std::string& sectionLC = getLowercase(section);
-        const std::string& entryLC = getLowercase(entry);
-        ContainerMap::iterator upper = this->containers_.upper_bound(sectionLC);
-        for (ContainerMap::iterator it = this->containers_.lower_bound(sectionLC); it != upper; ++it)
-        {
-            // Note: Config value vectors cannot be supported
-            if (it->second.first == entryLC && !it->second.second->isVector())
-            {
-                return (it->second.second->*function)(value);
-            }
-        }
-        return false;
-    }
-
-    /**
-        @brief Console-command: Returns the value of a given entry.
-
-        @param section  The section of the config value
-        @param entry    The name of the config value
-    */
-    std::string SettingsConfigFile::getConfig(const std::string& section, const std::string& entry)
-    {
-        const std::string& sectionLC = getLowercase(section);
-        const std::string& entryLC = getLowercase(entry);
-        ContainerMap::iterator upper = this->containers_.upper_bound(sectionLC);
-        for (ContainerMap::iterator it = this->containers_.lower_bound(sectionLC); it != upper; ++it)
-        {
-            // Note: Config value vectors cannot be supported
-            if (it->second.first == entryLC && ! it->second.second->isVector())
-            {
-                std::string value;
-                it->second.second->getValue<std::string, OrxonoxClass>(&value, NULL);
-                return value;
-            }
-        }
-        return "";
-    }
-
-
     ///////////////////////
     // ConfigFileManager //
Index: code/branches/core6/src/libraries/core/config/ConfigFileManager.h
===================================================================
--- code/branches/core6/src/libraries/core/config/ConfigFileManager.h	(revision 9558)
+++ code/branches/core6/src/libraries/core/config/ConfigFileManager.h	(revision 9559)
@@ -30,5 +30,5 @@
     @file
     @ingroup Config ConfigFile
-    @brief Declaration of ConfigFileManager and its helper classes, used to load and save config files.
+    @brief Declaration of ConfigFileManager, used to load and save config files.
 */
 
@@ -38,536 +38,10 @@
 #include "core/CorePrereqs.h"
 
-#include <list>
-#include <map>
-#include <set>
-#include <string>
 #include <boost/array.hpp>
 
 #include "util/Singleton.h"
 
-namespace orxonox // tolua_export
-{ // tolua_export
-
-    /////////////////////
-    // ConfigFileEntry //
-    /////////////////////
-    /**
-        @brief This class represents an entry in the config file.
-
-        This class is pure virtual. Use one of the derived classes to define the type of the entry.
-    */
-    class _CoreExport ConfigFileEntry
-    {
-        public:
-            /// Destructor
-            virtual ~ConfigFileEntry() {};
-
-            /// Changes the value of the entry.
-            virtual void setValue(const std::string& value) = 0;
-            /// Returns the value of the entry.
-            virtual const std::string& getValue() const = 0;
-
-            /// Returns the name of the entry
-            virtual const std::string& getName() const = 0;
-
-            /// Changes the comment of the entry (will be placed after the value)
-            virtual void setComment(const std::string& comment) = 0;
-
-            /// Returns the index of the entry in a vector (used only if it is a vector)
-            virtual unsigned int getIndex() const { return 0; }
-
-            /// Defines if this entry is treated as string which means some special treatment of special characters.
-            virtual void setString(bool bString) = 0;
-
-            /// Returns the line as it will be stored in the config file.
-            virtual const std::string& getFileEntry() const = 0;
-    };
-
-
-    //////////////////////////
-    // ConfigFileEntryValue //
-    //////////////////////////
-    /**
-        @brief This class represents a normal value in the config file.
-    */
-    class _CoreExport ConfigFileEntryValue : public ConfigFileEntry
-    {
-        public:
-            /**
-                @brief Constructor: Initializes the entry.
-
-                @param name                 The name of the entry
-                @param value                The value of the entry
-                @param bString              If true, the value is treated as string which means some special treatment of special characters.
-                @param additionalComment    An optional comment that will be placed behind the value in the config file
-            */
-            inline ConfigFileEntryValue(const std::string& name, const std::string& value = "", bool bString = false, const std::string& additionalComment = "")
-                : name_(name)
-                , value_(value)
-                , additionalComment_(additionalComment)
-                , bString_(bString)
-                { this->update(); }
-
-            /// Destructor
-            inline virtual ~ConfigFileEntryValue() {}
-
-            inline virtual const std::string& getName() const
-                { return this->name_; }
-
-            inline virtual void setComment(const std::string& comment)
-                { this->additionalComment_ = comment; this->update(); }
-
-            inline virtual void setValue(const std::string& value)
-                { this->value_ = value; this->update(); }
-            inline virtual const std::string& getValue() const
-                { return this->value_; }
-
-            inline void virtual setString(bool bString)
-                { this->bString_ = bString; this->update(); }
-
-            inline virtual const std::string& getFileEntry() const
-                { return this->fileEntry_; }
-
-            /// Returns the "key" of the value (in this case it's just the name of the entry, but for vectors it's different)
-            inline virtual const std::string& getKeyString() const
-                { return this->name_; }
-
-        protected:
-            virtual void update();
-
-            const std::string name_;            ///< The name of the value
-            std::string value_;                 ///< The value
-            std::string additionalComment_;     ///< The additional comment
-            std::string fileEntry_;             ///< The string as it will be stored in the config file
-            bool bString_;                      ///< If true, the value is treated as string which means some special treatment of special characters.
-    };
-
-
-    ////////////////////////////////
-    // ConfigFileEntryVectorValue //
-    ////////////////////////////////
-    /**
-        @brief Subclass of ConfigFileEntryValue, represents an element of a vector.
-    */
-    class _CoreExport ConfigFileEntryVectorValue : public ConfigFileEntryValue
-    {
-        public:
-            /**
-                @brief Constructor: Initializes the entry.
-
-                @param name                 The name of the vector
-                @param index                The index of the element in the vector
-                @param value                The value of the element
-                @param bString              If true, the value is treated as string which means some special treatment of special characters.
-                @param additionalComment    An optional comment that will be placed behind the value in the config file
-            */
-            inline ConfigFileEntryVectorValue(const std::string& name, unsigned int index, const std::string& value = "", bool bString = false, const std::string& additionalComment = "")
-                : ConfigFileEntryValue(name, value, bString, additionalComment)
-                , index_(index)
-                { this->update(); /*No virtual calls in base class ctor*/ }
-
-            /// Destructor
-            inline ~ConfigFileEntryVectorValue() {}
-
-            inline unsigned int getIndex() const
-                { return this->index_; }
-
-            /// Returns the "key" of the value (the name of the vector plus the index of the element)
-            inline const std::string& getKeyString() const
-                { return this->keyString_; }
-
-        private:
-            void update();
-
-            unsigned int index_;        ///< The index of the element in the vector
-            std::string keyString_;     ///< The full name of the entry (the name of the vector plus the index of the element)
-    };
-
-
-    ////////////////////////////
-    // ConfigFileEntryComment //
-    ////////////////////////////
-    /**
-        @brief This class represents a line in the config file which contains only a comment.
-    */
-    class _CoreExport ConfigFileEntryComment : public ConfigFileEntry
-    {
-        public:
-            /// Constructor: Initializes the object.
-            inline ConfigFileEntryComment(const std::string& comment) : comment_(comment) {}
-
-            /// Destructor
-            inline virtual ~ConfigFileEntryComment() {}
-
-            inline virtual const std::string& getName() const
-                { return this->comment_; }
-
-            inline virtual void setComment(const std::string& comment)
-                { this->comment_ = comment; }
-
-            inline virtual void setValue(const std::string& value)
-                {}
-            inline virtual const std::string& getValue() const
-                { return BLANKSTRING; }
-
-            inline void setString(bool bString)
-                {}
-
-            inline virtual const std::string& getFileEntry() const
-                { return this->comment_; }
-
-        private:
-            std::string comment_;   ///< The comment
-    };
-
-
-    ///////////////////////
-    // ConfigFileSection //
-    ///////////////////////
-    /**
-        @brief Represents a section in a config file.
-
-        A section has a name and a list of config values.
-    */
-    class _CoreExport ConfigFileSection
-    {
-        friend class ConfigFile;
-        friend class SettingsConfigFile;
-
-        public:
-            /**
-                @brief Constructor: Initializes the section.
-
-                @param name The name of the section
-                @param additionalComment An additional comment placed after the title of the section in the config file
-            */
-            inline ConfigFileSection(const std::string& name, const std::string& additionalComment = "")
-                : name_(name)
-                , additionalComment_(additionalComment)
-                , bUpdated_(false)
-                {}
-            ~ConfigFileSection();
-
-            /// Returns the name of the section.
-            inline const std::string& getName() const
-                { return this->name_; }
-
-            /// Changes the comment which is placed after the title of the section in the config file.
-            inline void setComment(const std::string& comment)
-                { this->additionalComment_ = comment; }
-
-            /**
-                @brief Stores a value in the section. If the entry doesn't exist, it's created.
-
-                @param name     The name of the entry
-                @param value    The new value
-                @param bString  If true, the value is treated as string which means some special treatment of special characters.
-            */
-            inline void setValue(const std::string& name, const std::string& value, bool bString)
-                { this->getOrCreateEntry(name, value, bString)->setValue(value); }
-            /**
-                @brief Returns the value of a given entry in the section. Returns a blank string if the value doesn't exist.
-
-                @param name     The name of the entry
-                @param bString  If true, the value is treated as string which means some special treatment of special characters.
-            */
-            inline const std::string& getValue(const std::string& name, bool bString)
-            {
-                ConfigFileEntry* entry = this->getEntry(name);
-                if (entry)
-                {
-                    entry->setString(bString);  // if the entry was loaded from the config file, we have to tell it if it's a string
-                    return entry->getValue();
-                }
-                return BLANKSTRING;
-            }
-            /**
-                @brief Returns the value of a given entry in the section. If it doesn't exist, the entry is created using the fallback value.
-
-                @param name     The name of the entry
-                @param fallback The value that will be used if the entry doesn't exist
-                @param bString  If true, the value is treated as string which means some special treatment of special characters.
-            */
-            inline const std::string& getOrCreateValue(const std::string& name, const std::string& fallback, bool bString)
-                { return this->getOrCreateEntry(name, fallback, bString)->getValue(); }
-
-            /**
-                @brief Stores the value of an element of a vector in the section. If the entry doesn't exist, it's created.
-
-                @param name     The name of the vector
-                @param index    The index of the element in the vector
-                @param value    The new value
-                @param bString  If true, the value is treated as string which means some special treatment of special characters.
-            */
-            inline void setValue(const std::string& name, unsigned int index, const std::string& value, bool bString)
-                { this->getOrCreateEntry(name, index, value, bString)->setValue(value); }
-            /**
-                @brief Returns the value of a given element of a vector in the section. Returns a blank string if the value doesn't exist.
-
-                @param name     The name of the vector
-                @param index    The index of the element in the vector
-                @param bString  If true, the value is treated as string which means some special treatment of special characters.
-            */
-            inline const std::string& getValue(const std::string& name, unsigned int index, bool bString)
-            {
-                ConfigFileEntry* entry = this->getEntry(name, index);
-                if (entry)
-                {
-                    entry->setString(bString);  // if the entry was loaded from the config file, we have to tell it if it's a string
-                    return entry->getValue();
-                }
-                return BLANKSTRING;
-            }
-            /**
-                @brief Returns the value of a given element of a vector in the section. If it doesn't exist, the entry is created using the fallback value.
-
-                @param name     The name of the vector
-                @param index    The index of the element in the vector
-                @param fallback The value that will be used if the entry doesn't exist
-                @param bString  If true, the value is treated as string which means some special treatment of special characters.
-            */
-            inline const std::string& getOrCreateValue(const std::string& name, unsigned int index, const std::string& fallback, bool bString)
-                { return this->getOrCreateEntry(name, index, fallback, bString)->getValue(); }
-
-            void deleteVectorEntries(const std::string& name, unsigned int startindex = 0);
-            unsigned int getVectorSize(const std::string& name) const;
-
-            std::string getFileEntry() const;
-
-        private:
-            /// Returns the list of entries in this section.
-            std::list<ConfigFileEntry*>& getEntries()
-                { return this->entries_; }
-            /// Returns the begin-iterator of the list of entries in this section.
-            std::list<ConfigFileEntry*>::const_iterator getEntriesBegin() const
-                { return this->entries_.begin(); }
-            /// Returns the end-iterator of the list of entries in this section.
-            std::list<ConfigFileEntry*>::const_iterator getEntriesEnd() const
-                { return this->entries_.end(); }
-
-            std::list<ConfigFileEntry*>::iterator getOrCreateEntryIterator(const std::string& name, const std::string& fallback, bool bString);
-            std::list<ConfigFileEntry*>::iterator getOrCreateEntryIterator(const std::string& name, unsigned int index, const std::string& fallback, bool bString);
-
-            ConfigFileEntry* getEntry(const std::string& name) const;
-            /**
-                @brief Returns the entry with given name. If it doesn't exist, the entry is created using the fallback value.
-
-                @param name     The name of the entry
-                @param fallback The value that will be used if the entry doesn't exist
-                @param bString  If true, the value is treated as string which means some special treatment of special characters.
-            */
-            inline ConfigFileEntry* getOrCreateEntry(const std::string& name, const std::string& fallback, bool bString)
-                { return (*this->getOrCreateEntryIterator(name, fallback, bString)); }
-
-            ConfigFileEntry* getEntry(const std::string& name, unsigned int index) const;
-            /**
-                @brief Returns the entry that contains an element of a vector with given name. If it doesn't exist, the entry is created using the fallback value.
-
-                @param name     The name of the entry
-                @param index    The index of the element in the vector
-                @param fallback The value that will be used if the entry doesn't exist
-                @param bString  If true, the value is treated as string which means some special treatment of special characters.
-            */
-            inline ConfigFileEntry* getOrCreateEntry(const std::string& name, unsigned int index, const std::string& fallback, bool bString)
-                { return (*this->getOrCreateEntryIterator(name, index, fallback, bString)); }
-
-            std::string name_;                      ///< The name of the section
-            std::string additionalComment_;         ///< The additional comment which is placed after the title of the section in the config file
-            std::list<ConfigFileEntry*> entries_;   ///< The list of entries in this section
-            bool bUpdated_;                         ///< True if an entry is created
-    };
-
-
-    ////////////////
-    // ConfigFile //
-    ////////////////
-    /**
-        @brief This class represents a config file, which is stored on the hard-disk and contains config values in different sections.
-
-        It provides an interface to manipulate the sections and values.
-    */
-    class _CoreExport ConfigFile
-    {
-        public:
-            ConfigFile(const std::string& filename, bool bCopyFallbackFile = true);
-            virtual ~ConfigFile();
-
-            virtual void load();
-            virtual void save() const;
-            virtual void saveAs(const std::string& filename) const;
-            virtual void clear();
-
-            /// Returns the file-name of this config file
-            inline const std::string& getFilename()
-                { return this->filename_; }
-
-            /**
-                @brief Stores a value in the config file. If the entry or its section doesn't exist, it's created.
-
-                @param section  The name of the section
-                @param name     The name of the entry
-                @param value    The new value
-                @param bString  If true, the value is treated as string which means some special treatment of special characters.
-            */
-            inline void setValue(const std::string& section, const std::string& name, const std::string& value, bool bString)
-            {
-                this->getOrCreateSection(section)->setValue(name, value, bString);
-                this->save();
-            }
-            /**
-                @brief Returns the value of a given entry in the config file. Returns a blank string if the value doesn't exist.
-
-                @param section  The name of the section
-                @param name     The name of the entry
-                @param bString  If true, the value is treated as string which means some special treatment of special characters.
-            */
-            inline const std::string& getValue(const std::string& section, const std::string& name, bool bString)
-            {
-                ConfigFileSection* sectionPtr = this->getSection(section);
-                return (sectionPtr ? sectionPtr->getValue(name, bString) : BLANKSTRING);
-            }
-            /**
-                @brief Returns the value of a given entry in the config file. If it doesn't exist, the entry is created using the fallback value.
-
-                @param section  The name of the section
-                @param name     The name of the entry
-                @param fallback The value that will be used if the entry doesn't exist
-                @param bString  If true, the value is treated as string which means some special treatment of special characters.
-            */
-            inline const std::string& getOrCreateValue(const std::string& section, const std::string& name, const std::string& fallback, bool bString)
-            {
-                const std::string& output = this->getOrCreateSection(section)->getOrCreateValue(name, fallback, bString);
-                this->saveIfUpdated();
-                return output;
-            }
-
-            /**
-                @brief Stores the value of an element of a vector in the config file. If the entry or its section doesn't exist, it's created.
-
-                @param section  The name of the section
-                @param name     The name of the vector
-                @param index    The index of the element in the vector
-                @param value    The new value
-                @param bString  If true, the value is treated as string which means some special treatment of special characters.
-            */
-            inline void setValue(const std::string& section, const std::string& name, unsigned int index, const std::string& value, bool bString)
-            {
-                this->getOrCreateSection(section)->setValue(name, index, value, bString);
-                this->save();
-            }
-            /**
-                @brief Returns the value of a given element of a vector in the config file. Returns a blank string if the value doesn't exist.
-
-                @param section  The name of the section
-                @param name     The name of the vector
-                @param index    The index of the element in the vector
-                @param bString  If true, the value is treated as string which means some special treatment of special characters.
-            */
-            inline const std::string& getValue(const std::string& section, const std::string& name, unsigned int index, bool bString)
-            {
-                ConfigFileSection* sectionPtr = this->getSection(section);
-                return (sectionPtr ? sectionPtr->getValue(name, index, bString) : BLANKSTRING);
-            }
-            /**
-                @brief Returns the value of a given element of a vector in the config file. If it doesn't exist, the entry is created using the fallback value.
-
-                @param section  The name of the section
-                @param name     The name of the vector
-                @param index    The index of the element in the vector
-                @param fallback The value that will be used if the entry doesn't exist
-                @param bString  If true, the value is treated as string which means some special treatment of special characters.
-            */
-            const std::string& getOrCreateValue(const std::string& section, const std::string& name, unsigned int index, const std::string& fallback, bool bString)
-            {
-                const std::string& output = this->getOrCreateSection(section)->getOrCreateValue(name, index, fallback, bString);
-                this->saveIfUpdated();
-                return output;
-            }
-
-            void deleteVectorEntries(const std::string& section, const std::string& name, unsigned int startindex = 0);
-            /**
-                @brief Returns the size of a config vector.
-                @param section  The section of the vector
-                @param name     The name of the vector
-            */
-            inline unsigned int getVectorSize(const std::string& section, const std::string& name) const
-            {
-                ConfigFileSection* sectionPtr = this->getSection(section);
-                return (sectionPtr ? sectionPtr->getVectorSize(name) : 0);
-            }
-
-            static const char* DEFAULT_CONFIG_FOLDER;   ///< The folder where the default config files will be stored
-
-        protected:
-            ConfigFileSection* getSection(const std::string& section) const;
-            ConfigFileSection* getOrCreateSection(const std::string& section);
-
-            std::list<ConfigFileSection*> sections_;    ///< A list of sections in this config file
-
-        private:
-            void saveIfUpdated();
-
-            const std::string filename_;                ///< The filename of this config file
-            const bool bCopyFallbackFile_;              ///< If true, the default config file is copied into the config-directory before loading the file
-            bool bUpdated_;                             ///< Becomes true if a section is added
-    };
-
-
-    ////////////////////////
-    // SettingsConfigFile //
-    ////////////////////////
-    /**
-        @brief Child class of ConfigFile, used to store the settings of the game.
-
-        In addition to ConfigFile, this class provides an interface to manipulate the settings
-        with console commands and to cache entries in instances of ConfigValueContainer.
-
-        SettingsConfigFile is a Singleton, meaning there's only one instance of this class
-        (and thus only one config file that stores settings).
-    */
-    class _CoreExport SettingsConfigFile // tolua_export
-        : public ConfigFile, public Singleton<SettingsConfigFile>
-    { // tolua_export
-        friend class Singleton<SettingsConfigFile>;
-
-        public:
-            typedef std::multimap<std::string, std::pair<std::string, ConfigValueContainer*> > ContainerMap;
-
-            SettingsConfigFile(const std::string& filename);
-            ~SettingsConfigFile();
-
-            void load(); // tolua_export
-            void setFilename(const std::string& filename); // tolua_export
-            void clean(bool bCleanComments = false); // tolua_export
-
-            void config(const std::string& section, const std::string& entry, const std::string& value); // tolua_export
-            void tconfig(const std::string& section, const std::string& entry, const std::string& value); // tolua_export
-            std::string getConfig(const std::string& section, const std::string& entry); // tolua_export
-
-            void addConfigValueContainer(ConfigValueContainer* container);
-            void removeConfigValueContainer(ConfigValueContainer* container);
-
-            /// Returns a set containing the names of all sections in this config file.
-            inline const std::set<std::string>& getSectionNames()
-                { return this->sectionNames_; }
-            /// Returns the lower-bound-iterator of the @ref ConfigValueContainer "config value containers" for the given section.
-            inline ContainerMap::const_iterator getContainerLowerBound(const std::string section)
-                { return this->containers_.lower_bound(section); }
-            /// Returns the upper-bound-iterator of the @ref ConfigValueContainer "config value containers" for the given section.
-            inline ContainerMap::const_iterator getContainerUpperBound(const std::string section)
-                { return this->containers_.upper_bound(section); }
-
-            static SettingsConfigFile& getInstance() { return Singleton<SettingsConfigFile>::getInstance(); } // tolua_export
-
-        private:
-            void updateConfigValues();
-            bool configImpl(const std::string& section, const std::string& entry, const std::string& value, bool (ConfigValueContainer::*function)(const MultiType&));
-
-            ContainerMap containers_;                   ///< Stores all @ref ConfigValueContainer "config value containers"
-            std::set<std::string> sectionNames_;        ///< Stores all section names
-            static SettingsConfigFile* singletonPtr_s;  ///< The singleton pointer
-    }; // tolua_export
-
-
+namespace orxonox
+{
     ///////////////////////
     // ConfigFileManager //
@@ -598,5 +72,5 @@
             static ConfigFileManager* singletonPtr_s;       ///< Stores the singleton-pointer
     };
-} // tolua_export
+}
 
 #endif /* _ConfigFileManager_H__ */
Index: code/branches/core6/src/libraries/core/config/ConfigFileSection.cc
===================================================================
--- code/branches/core6/src/libraries/core/config/ConfigFileSection.cc	(revision 9559)
+++ code/branches/core6/src/libraries/core/config/ConfigFileSection.cc	(revision 9559)
@@ -0,0 +1,180 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of ConfigFileSection.
+*/
+
+#include "ConfigFileSection.h"
+
+#include "ConfigFileEntryValue.h"
+#include "ConfigFileEntryVectorValue.h"
+
+namespace orxonox
+{
+    ///////////////////////
+    // ConfigFileSection //
+    ///////////////////////
+    /**
+        @brief Destructor: Deletes all entries.
+    */
+    ConfigFileSection::~ConfigFileSection()
+    {
+        for (std::list<ConfigFileEntry*>::iterator it = this->entries_.begin(); it != this->entries_.end(); )
+            delete (*(it++));
+    }
+
+    /**
+        @brief Deletes all elements of a config vector if their index is greater or equal to @a startindex.
+
+        @param name         The name of the vector
+        @param startindex   The index of the first element that will be deleted
+    */
+    void ConfigFileSection::deleteVectorEntries(const std::string& name, unsigned int startindex)
+    {
+        for (std::list<ConfigFileEntry*>::iterator it = this->entries_.begin(); it != this->entries_.end(); )
+        {
+            if (((*it)->getName() == name) && ((*it)->getIndex() >= startindex))
+            {
+                delete (*it);
+                this->entries_.erase(it++);
+            }
+            else
+            {
+                ++it;
+            }
+        }
+    }
+
+    /**
+        @brief Returns the size of a config vector.
+        @param name     The name of the vector
+    */
+    unsigned int ConfigFileSection::getVectorSize(const std::string& name) const
+    {
+        unsigned int size = 0;
+        for (std::list<ConfigFileEntry*>::const_iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
+            if ((*it)->getName() == name)
+                if ((*it)->getIndex() >= size)
+                    size = (*it)->getIndex() + 1;
+        return size;
+    }
+
+    /**
+        @brief Returns the title and comment of the section as it will be stored in the file.
+    */
+    std::string ConfigFileSection::getFileEntry() const
+    {
+        if (this->additionalComment_.empty())
+            return ('[' + this->name_ + ']');
+        else
+            return ('[' + this->name_ + "] " + this->additionalComment_);
+    }
+
+    /**
+        @brief Returns the entry with given name (or NULL if it doesn't exist).
+
+        @param name     The name of the entry
+    */
+    ConfigFileEntry* ConfigFileSection::getEntry(const std::string& name) const
+    {
+        for (std::list<ConfigFileEntry*>::const_iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
+        {
+            if ((*it)->getName() == name)
+                return *it;
+        }
+        return NULL;
+    }
+
+    /**
+        @brief Returns the entry of a vector element with given name and index (or NULL if it doesn't exist).
+
+        @param name     The name of the vector
+        @param index    The index of the element in the vector
+    */
+    ConfigFileEntry* ConfigFileSection::getEntry(const std::string& name, unsigned int index) const
+    {
+        for (std::list<ConfigFileEntry*>::const_iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
+        {
+            if (((*it)->getName() == name) && ((*it)->getIndex() == index))
+                return *it;
+        }
+        return NULL;
+    }
+
+    /**
+        @brief Returns the iterator to the entry with given name. If the entry doesn't exist, it is created using the fallback value.
+
+        @param name     The name of the entry
+        @param fallback The value that will be used if the entry doesn't exist
+        @param bString  If true, the value is treated as string which means some special treatment of special characters.
+    */
+    std::list<ConfigFileEntry*>::iterator ConfigFileSection::getOrCreateEntryIterator(const std::string& name, const std::string& fallback, bool bString)
+    {
+        for (std::list<ConfigFileEntry*>::iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
+        {
+            if ((*it)->getName() == name)
+            {
+                (*it)->setString(bString);
+                return it;
+            }
+        }
+
+        this->bUpdated_ = true;
+
+        return this->entries_.insert(this->entries_.end(), new ConfigFileEntryValue(name, fallback, bString));
+    }
+
+    /**
+        @brief Returns the iterator to the entry of a vector element with given name and index. If the entry doesn't exist, it is created using the fallback value.
+
+        @param name     The name of the vector
+        @param index    The index of the element in the vector
+        @param fallback The value that will be used if the entry doesn't exist
+        @param bString  If true, the value is treated as string which means some special treatment of special characters.
+    */
+    std::list<ConfigFileEntry*>::iterator ConfigFileSection::getOrCreateEntryIterator(const std::string& name, unsigned int index, const std::string& fallback, bool bString)
+    {
+        for (std::list<ConfigFileEntry*>::iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
+        {
+            if (((*it)->getName() == name) && ((*it)->getIndex() == index))
+            {
+                (*it)->setString(bString);
+                return it;
+            }
+        }
+
+        this->bUpdated_ = true;
+
+        if (index == 0)
+            return this->entries_.insert(this->entries_.end(), new ConfigFileEntryVectorValue(name, index, fallback, bString));
+        else
+            return this->entries_.insert(++this->getOrCreateEntryIterator(name, index - 1, "", bString), new ConfigFileEntryVectorValue(name, index, fallback, bString));
+    }
+}
Index: code/branches/core6/src/libraries/core/config/ConfigFileSection.h
===================================================================
--- code/branches/core6/src/libraries/core/config/ConfigFileSection.h	(revision 9559)
+++ code/branches/core6/src/libraries/core/config/ConfigFileSection.h	(revision 9559)
@@ -0,0 +1,200 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @ingroup Config ConfigFile
+*/
+
+#ifndef _ConfigFileSection_H__
+#define _ConfigFileSection_H__
+
+#include "core/CorePrereqs.h"
+
+#include "ConfigFileEntry.h"
+
+namespace orxonox
+{
+    ///////////////////////
+    // ConfigFileSection //
+    ///////////////////////
+    /**
+        @brief Represents a section in a config file.
+
+        A section has a name and a list of config values.
+    */
+    class _CoreExport ConfigFileSection
+    {
+        friend class ConfigFile;
+        friend class SettingsConfigFile;
+
+        public:
+            /**
+                @brief Constructor: Initializes the section.
+
+                @param name The name of the section
+                @param additionalComment An additional comment placed after the title of the section in the config file
+            */
+            inline ConfigFileSection(const std::string& name, const std::string& additionalComment = "")
+                : name_(name)
+                , additionalComment_(additionalComment)
+                , bUpdated_(false)
+                {}
+            ~ConfigFileSection();
+
+            /// Returns the name of the section.
+            inline const std::string& getName() const
+                { return this->name_; }
+
+            /// Changes the comment which is placed after the title of the section in the config file.
+            inline void setComment(const std::string& comment)
+                { this->additionalComment_ = comment; }
+
+            /**
+                @brief Stores a value in the section. If the entry doesn't exist, it's created.
+
+                @param name     The name of the entry
+                @param value    The new value
+                @param bString  If true, the value is treated as string which means some special treatment of special characters.
+            */
+            inline void setValue(const std::string& name, const std::string& value, bool bString)
+                { this->getOrCreateEntry(name, value, bString)->setValue(value); }
+            /**
+                @brief Returns the value of a given entry in the section. Returns a blank string if the value doesn't exist.
+
+                @param name     The name of the entry
+                @param bString  If true, the value is treated as string which means some special treatment of special characters.
+            */
+            inline const std::string& getValue(const std::string& name, bool bString)
+            {
+                ConfigFileEntry* entry = this->getEntry(name);
+                if (entry)
+                {
+                    entry->setString(bString);  // if the entry was loaded from the config file, we have to tell it if it's a string
+                    return entry->getValue();
+                }
+                return BLANKSTRING;
+            }
+            /**
+                @brief Returns the value of a given entry in the section. If it doesn't exist, the entry is created using the fallback value.
+
+                @param name     The name of the entry
+                @param fallback The value that will be used if the entry doesn't exist
+                @param bString  If true, the value is treated as string which means some special treatment of special characters.
+            */
+            inline const std::string& getOrCreateValue(const std::string& name, const std::string& fallback, bool bString)
+                { return this->getOrCreateEntry(name, fallback, bString)->getValue(); }
+
+            /**
+                @brief Stores the value of an element of a vector in the section. If the entry doesn't exist, it's created.
+
+                @param name     The name of the vector
+                @param index    The index of the element in the vector
+                @param value    The new value
+                @param bString  If true, the value is treated as string which means some special treatment of special characters.
+            */
+            inline void setValue(const std::string& name, unsigned int index, const std::string& value, bool bString)
+                { this->getOrCreateEntry(name, index, value, bString)->setValue(value); }
+            /**
+                @brief Returns the value of a given element of a vector in the section. Returns a blank string if the value doesn't exist.
+
+                @param name     The name of the vector
+                @param index    The index of the element in the vector
+                @param bString  If true, the value is treated as string which means some special treatment of special characters.
+            */
+            inline const std::string& getValue(const std::string& name, unsigned int index, bool bString)
+            {
+                ConfigFileEntry* entry = this->getEntry(name, index);
+                if (entry)
+                {
+                    entry->setString(bString);  // if the entry was loaded from the config file, we have to tell it if it's a string
+                    return entry->getValue();
+                }
+                return BLANKSTRING;
+            }
+            /**
+                @brief Returns the value of a given element of a vector in the section. If it doesn't exist, the entry is created using the fallback value.
+
+                @param name     The name of the vector
+                @param index    The index of the element in the vector
+                @param fallback The value that will be used if the entry doesn't exist
+                @param bString  If true, the value is treated as string which means some special treatment of special characters.
+            */
+            inline const std::string& getOrCreateValue(const std::string& name, unsigned int index, const std::string& fallback, bool bString)
+                { return this->getOrCreateEntry(name, index, fallback, bString)->getValue(); }
+
+            void deleteVectorEntries(const std::string& name, unsigned int startindex = 0);
+            unsigned int getVectorSize(const std::string& name) const;
+
+            std::string getFileEntry() const;
+
+        private:
+            /// Returns the list of entries in this section.
+            std::list<ConfigFileEntry*>& getEntries()
+                { return this->entries_; }
+            /// Returns the begin-iterator of the list of entries in this section.
+            std::list<ConfigFileEntry*>::const_iterator getEntriesBegin() const
+                { return this->entries_.begin(); }
+            /// Returns the end-iterator of the list of entries in this section.
+            std::list<ConfigFileEntry*>::const_iterator getEntriesEnd() const
+                { return this->entries_.end(); }
+
+            std::list<ConfigFileEntry*>::iterator getOrCreateEntryIterator(const std::string& name, const std::string& fallback, bool bString);
+            std::list<ConfigFileEntry*>::iterator getOrCreateEntryIterator(const std::string& name, unsigned int index, const std::string& fallback, bool bString);
+
+            ConfigFileEntry* getEntry(const std::string& name) const;
+            /**
+                @brief Returns the entry with given name. If it doesn't exist, the entry is created using the fallback value.
+
+                @param name     The name of the entry
+                @param fallback The value that will be used if the entry doesn't exist
+                @param bString  If true, the value is treated as string which means some special treatment of special characters.
+            */
+            inline ConfigFileEntry* getOrCreateEntry(const std::string& name, const std::string& fallback, bool bString)
+                { return (*this->getOrCreateEntryIterator(name, fallback, bString)); }
+
+            ConfigFileEntry* getEntry(const std::string& name, unsigned int index) const;
+            /**
+                @brief Returns the entry that contains an element of a vector with given name. If it doesn't exist, the entry is created using the fallback value.
+
+                @param name     The name of the entry
+                @param index    The index of the element in the vector
+                @param fallback The value that will be used if the entry doesn't exist
+                @param bString  If true, the value is treated as string which means some special treatment of special characters.
+            */
+            inline ConfigFileEntry* getOrCreateEntry(const std::string& name, unsigned int index, const std::string& fallback, bool bString)
+                { return (*this->getOrCreateEntryIterator(name, index, fallback, bString)); }
+
+            std::string name_;                      ///< The name of the section
+            std::string additionalComment_;         ///< The additional comment which is placed after the title of the section in the config file
+            std::list<ConfigFileEntry*> entries_;   ///< The list of entries in this section
+            bool bUpdated_;                         ///< True if an entry is created
+    };
+}
+
+#endif /* _ConfigFileSection_H__ */
Index: code/branches/core6/src/libraries/core/config/ConfigValueContainer.cc
===================================================================
--- code/branches/core6/src/libraries/core/config/ConfigValueContainer.cc	(revision 9558)
+++ code/branches/core6/src/libraries/core/config/ConfigValueContainer.cc	(revision 9559)
@@ -38,4 +38,5 @@
 #include "core/Language.h"
 #include "ConfigFileManager.h"
+#include "SettingsConfigFile.h"
 
 namespace orxonox
Index: code/branches/core6/src/libraries/core/config/SettingsConfigFile.cc
===================================================================
--- code/branches/core6/src/libraries/core/config/SettingsConfigFile.cc	(revision 9559)
+++ code/branches/core6/src/libraries/core/config/SettingsConfigFile.cc	(revision 9559)
@@ -0,0 +1,277 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of SettingsConfigFile.
+*/
+
+#include "SettingsConfigFile.h"
+
+#include "util/StringUtils.h"
+#include "core/command/ConsoleCommand.h"
+#include "ConfigFileManager.h"
+#include "ConfigValueContainer.h"
+
+namespace orxonox
+{
+    ////////////////////////
+    // SettingsConfigFile //
+    ////////////////////////
+
+    static const std::string __CC_load_name = "reloadSettings";
+    static const std::string __CC_setFilename_name = "setSettingsFile";
+    static const std::string __CC_config_name = "config";
+    static const std::string __CC_tconfig_name = "tconfig";
+    static const std::string __CC_getConfig_name = "getConfig";
+
+    SetConsoleCommand(__CC_load_name,            &ConfigFile::load);
+    SetConsoleCommand(__CC_setFilename_name,     &SettingsConfigFile::setFilename);
+    SetConsoleCommand(__CC_config_name,          &SettingsConfigFile::config).argumentCompleter(0, autocompletion::settingssections()).argumentCompleter(1, autocompletion::settingsentries()).argumentCompleter(2, autocompletion::settingsvalue());
+    SetConsoleCommand(__CC_tconfig_name,         &SettingsConfigFile::tconfig).argumentCompleter(0, autocompletion::settingssections()).argumentCompleter(1, autocompletion::settingsentries()).argumentCompleter(2, autocompletion::settingsvalue());
+    SetConsoleCommand(__CC_getConfig_name,       &SettingsConfigFile::getConfig).argumentCompleter(0, autocompletion::settingssections()).argumentCompleter(1, autocompletion::settingsentries());
+
+    SettingsConfigFile* SettingsConfigFile::singletonPtr_s = 0;
+
+    /**
+        @brief Constructor: Activates the console commands.
+    */
+    SettingsConfigFile::SettingsConfigFile(const std::string& filename)
+        : ConfigFile(filename)
+    {
+        ModifyConsoleCommand(__CC_load_name).setObject(this);
+        ModifyConsoleCommand(__CC_setFilename_name).setObject(this);
+        ModifyConsoleCommand(__CC_config_name).setObject(this);
+        ModifyConsoleCommand(__CC_tconfig_name).setObject(this);
+        ModifyConsoleCommand(__CC_getConfig_name).setObject(this);
+    }
+
+    /**
+        @brief Destructor: Deactivates the console commands.
+    */
+    SettingsConfigFile::~SettingsConfigFile()
+    {
+        ModifyConsoleCommand(__CC_load_name).setObject(0);
+        ModifyConsoleCommand(__CC_setFilename_name).setObject(0);
+        ModifyConsoleCommand(__CC_config_name).setObject(0);
+        ModifyConsoleCommand(__CC_tconfig_name).setObject(0);
+        ModifyConsoleCommand(__CC_getConfig_name).setObject(0);
+    }
+
+    /**
+        @brief Loads the config file and updates the @ref ConfigValueContainer "config value containers".
+    */
+    void SettingsConfigFile::load()
+    {
+        ConfigFile::load();
+        this->updateConfigValues();
+    }
+
+    /**
+        @brief Changes the file-name.
+    */
+    void SettingsConfigFile::setFilename(const std::string& filename)
+    {
+        ConfigFileManager::getInstance().setFilename(ConfigFileType::Settings, filename);
+    }
+
+    /**
+        @brief Registers a new @ref ConfigValueContainer "config value container".
+    */
+    void SettingsConfigFile::addConfigValueContainer(ConfigValueContainer* container)
+    {
+        if (container == NULL)
+            return;
+        std::pair<std::string, ConfigValueContainer*> second(getLowercase(container->getName()), container);
+        this->containers_.insert(std::make_pair(getLowercase(container->getSectionName()), second));
+        this->sectionNames_.insert(container->getSectionName());
+    }
+
+    /**
+        @brief Unregisters a @ref ConfigValueContainer "config value container".
+    */
+    void SettingsConfigFile::removeConfigValueContainer(ConfigValueContainer* container)
+    {
+        if (container == NULL)
+            return;
+        const std::string& sectionLC = getLowercase(container->getSectionName());
+        ContainerMap::iterator upper = this->containers_.upper_bound(sectionLC);
+        for (ContainerMap::iterator it = this->containers_.lower_bound(sectionLC); it != upper; ++it)
+        {
+            if (it->second.second == container)
+            {
+                // Remove entry from section name set this was the last container for that section
+                if (upper == this->containers_.lower_bound(sectionLC))
+                    this->sectionNames_.erase(container->getSectionName());
+                this->containers_.erase(it);
+                break;
+            }
+        }
+    }
+
+    /**
+        @brief Updates all @ref ConfigValueContainer "config value containers".
+    */
+    void SettingsConfigFile::updateConfigValues()
+    {
+        // todo: can this be done more efficiently? looks like some identifiers will be updated multiple times.
+
+        for (ContainerMap::const_iterator it = this->containers_.begin(); it != this->containers_.end(); ++it)
+        {
+            it->second.second->update();
+            it->second.second->getIdentifier()->updateConfigValues();
+        }
+    }
+
+    /**
+        @brief Removes entries and sections from the file that don't exist anymore (i.e. if there's no corresponding @ref ConfigValueContainer "config value container").
+        @param bCleanComments If true, comments are also removed from the file
+    */
+    void SettingsConfigFile::clean(bool bCleanComments)
+    {
+        for (std::list<ConfigFileSection*>::iterator itSection = this->sections_.begin(); itSection != this->sections_.end(); )
+        {
+            const std::string& sectionLC = getLowercase((*itSection)->getName());
+            ContainerMap::const_iterator lower = this->containers_.lower_bound(sectionLC);
+            ContainerMap::const_iterator upper = this->containers_.upper_bound(sectionLC);
+            if (lower != upper)
+            {
+                // The section exists, delete comment
+                if (bCleanComments)
+                    (*itSection)->setComment("");
+                for (std::list<ConfigFileEntry*>::iterator itEntry = (*itSection)->entries_.begin(); itEntry != (*itSection)->entries_.end(); )
+                {
+                    const std::string& entryLC = getLowercase((*itEntry)->getName());
+                    bool bFound = false;
+                    for (ContainerMap::const_iterator itContainer = lower; itContainer != upper; ++itContainer)
+                    {
+                        if (itContainer->second.first == entryLC)
+                        {
+                            // The config-value exists, delete comment
+                            if (bCleanComments)
+                                (*itEntry)->setComment("");
+                            ++itEntry;
+                            bFound = true;
+                            break;
+                        }
+                    }
+                    if (!bFound)
+                    {
+                        // The config-value doesn't exist
+                        delete (*itEntry);
+                        (*itSection)->entries_.erase(itEntry++);
+                    }
+                }
+                ++itSection;
+            }
+            else
+            {
+                // The section doesn't exist
+                delete (*itSection);
+                this->sections_.erase(itSection++);
+            }
+        }
+
+        // Save the file
+        this->save();
+    }
+
+    /**
+        @brief Console-command: Changes the value of an entry and stores it the file.
+
+        @param section  The section of the config value
+        @param entry    The name of the config value
+        @param value    The new value
+    */
+    void SettingsConfigFile::config(const std::string& section, const std::string& entry, const std::string& value)
+    {
+        if (!this->configImpl(section, entry, value, &ConfigValueContainer::set))
+            orxout(user_error, context::config) << "Config value \"" << entry << "\" in section \"" << section << "\" doesn't exist." << endl;
+    }
+
+    /**
+        @brief Console-command: Changes the value of an entry, but doesn't store it in the file (it's only a temporary change).
+
+        @param section  The section of the config value
+        @param entry    The name of the config value
+        @param value    The new value
+    */
+    void SettingsConfigFile::tconfig(const std::string& section, const std::string& entry, const std::string& value)
+    {
+        if (!this->configImpl(section, entry, value, &ConfigValueContainer::tset))
+            orxout(user_error, context::config) << "Config value \"" << entry << "\" in section \"" << section << "\" doesn't exist." << endl;
+    }
+
+    /**
+        @brief Changes the value of an entry, depending on @a function, either by using "set" or "tset"
+
+        @param section  The section of the config value
+        @param entry    The name of the config value
+        @param value    The new value
+        @param function The function ("set" or "tset") that will be used to change the value.
+    */
+    bool SettingsConfigFile::configImpl(const std::string& section, const std::string& entry, const std::string& value, bool (ConfigValueContainer::*function)(const MultiType&))
+    {
+        const std::string& sectionLC = getLowercase(section);
+        const std::string& entryLC = getLowercase(entry);
+        ContainerMap::iterator upper = this->containers_.upper_bound(sectionLC);
+        for (ContainerMap::iterator it = this->containers_.lower_bound(sectionLC); it != upper; ++it)
+        {
+            // Note: Config value vectors cannot be supported
+            if (it->second.first == entryLC && !it->second.second->isVector())
+            {
+                return (it->second.second->*function)(value);
+            }
+        }
+        return false;
+    }
+
+    /**
+        @brief Console-command: Returns the value of a given entry.
+
+        @param section  The section of the config value
+        @param entry    The name of the config value
+    */
+    std::string SettingsConfigFile::getConfig(const std::string& section, const std::string& entry)
+    {
+        const std::string& sectionLC = getLowercase(section);
+        const std::string& entryLC = getLowercase(entry);
+        ContainerMap::iterator upper = this->containers_.upper_bound(sectionLC);
+        for (ContainerMap::iterator it = this->containers_.lower_bound(sectionLC); it != upper; ++it)
+        {
+            // Note: Config value vectors cannot be supported
+            if (it->second.first == entryLC && ! it->second.second->isVector())
+            {
+                std::string value;
+                it->second.second->getValue<std::string, OrxonoxClass>(&value, NULL);
+                return value;
+            }
+        }
+        return "";
+    }
+}
Index: code/branches/core6/src/libraries/core/config/SettingsConfigFile.h
===================================================================
--- code/branches/core6/src/libraries/core/config/SettingsConfigFile.h	(revision 9559)
+++ code/branches/core6/src/libraries/core/config/SettingsConfigFile.h	(revision 9559)
@@ -0,0 +1,101 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @ingroup Config ConfigFile
+*/
+
+#ifndef _SettingsConfigFile_H__
+#define _SettingsConfigFile_H__
+
+#include "core/CorePrereqs.h"
+
+#include "ConfigFile.h"
+#include "util/Singleton.h"
+
+namespace orxonox // tolua_export
+{ // tolua_export
+
+    ////////////////////////
+    // SettingsConfigFile //
+    ////////////////////////
+    /**
+        @brief Child class of ConfigFile, used to store the settings of the game.
+
+        In addition to ConfigFile, this class provides an interface to manipulate the settings
+        with console commands and to cache entries in instances of ConfigValueContainer.
+
+        SettingsConfigFile is a Singleton, meaning there's only one instance of this class
+        (and thus only one config file that stores settings).
+    */
+    class _CoreExport SettingsConfigFile // tolua_export
+        : public ConfigFile, public Singleton<SettingsConfigFile>
+    { // tolua_export
+        friend class Singleton<SettingsConfigFile>;
+
+        public:
+            typedef std::multimap<std::string, std::pair<std::string, ConfigValueContainer*> > ContainerMap;
+
+            SettingsConfigFile(const std::string& filename);
+            ~SettingsConfigFile();
+
+            void load(); // tolua_export
+            void setFilename(const std::string& filename); // tolua_export
+            void clean(bool bCleanComments = false); // tolua_export
+
+            void config(const std::string& section, const std::string& entry, const std::string& value); // tolua_export
+            void tconfig(const std::string& section, const std::string& entry, const std::string& value); // tolua_export
+            std::string getConfig(const std::string& section, const std::string& entry); // tolua_export
+
+            void addConfigValueContainer(ConfigValueContainer* container);
+            void removeConfigValueContainer(ConfigValueContainer* container);
+
+            /// Returns a set containing the names of all sections in this config file.
+            inline const std::set<std::string>& getSectionNames()
+                { return this->sectionNames_; }
+            /// Returns the lower-bound-iterator of the @ref ConfigValueContainer "config value containers" for the given section.
+            inline ContainerMap::const_iterator getContainerLowerBound(const std::string section)
+                { return this->containers_.lower_bound(section); }
+            /// Returns the upper-bound-iterator of the @ref ConfigValueContainer "config value containers" for the given section.
+            inline ContainerMap::const_iterator getContainerUpperBound(const std::string section)
+                { return this->containers_.upper_bound(section); }
+
+            static SettingsConfigFile& getInstance() { return Singleton<SettingsConfigFile>::getInstance(); } // tolua_export
+
+        private:
+            void updateConfigValues();
+            bool configImpl(const std::string& section, const std::string& entry, const std::string& value, bool (ConfigValueContainer::*function)(const MultiType&));
+
+            ContainerMap containers_;                   ///< Stores all @ref ConfigValueContainer "config value containers"
+            std::set<std::string> sectionNames_;        ///< Stores all section names
+            static SettingsConfigFile* singletonPtr_s;  ///< The singleton pointer
+    }; // tolua_export
+} // tolua_export
+
+#endif /* _SettingsConfigFile_H__ */
Index: code/branches/core6/src/libraries/core/input/Button.cc
===================================================================
--- code/branches/core6/src/libraries/core/input/Button.cc	(revision 9558)
+++ code/branches/core6/src/libraries/core/input/Button.cc	(revision 9559)
@@ -42,5 +42,5 @@
 #include "core/command/CommandEvaluation.h"
 #include "core/command/CommandExecutor.h"
-#include "core/config/ConfigFileManager.h"
+#include "core/config/ConfigFile.h"
 
 namespace orxonox
Index: code/branches/core6/src/libraries/core/input/JoyStick.cc
===================================================================
--- code/branches/core6/src/libraries/core/input/JoyStick.cc	(revision 9558)
+++ code/branches/core6/src/libraries/core/input/JoyStick.cc	(revision 9559)
@@ -34,4 +34,5 @@
 
 #include "util/StringUtils.h"
+#include "core/config/ConfigFile.h"
 #include "core/config/ConfigFileManager.h"
 #include "core/config/ConfigValueIncludes.h"
Index: code/branches/core6/src/libraries/core/input/KeyBinder.cc
===================================================================
--- code/branches/core6/src/libraries/core/input/KeyBinder.cc	(revision 9558)
+++ code/branches/core6/src/libraries/core/input/KeyBinder.cc	(revision 9559)
@@ -36,5 +36,5 @@
 #include "core/CoreIncludes.h"
 #include "core/config/ConfigValueIncludes.h"
-#include "core/config/ConfigFileManager.h"
+#include "core/config/ConfigFile.h"
 #include "core/PathConfig.h"
 #include "InputCommands.h"
Index: code/branches/core6/src/libraries/network/WANDiscovery.h
===================================================================
--- code/branches/core6/src/libraries/network/WANDiscovery.h	(revision 9558)
+++ code/branches/core6/src/libraries/network/WANDiscovery.h	(revision 9559)
@@ -33,5 +33,4 @@
 #include "core/CoreIncludes.h"
 #include "core/OrxonoxClass.h"
-#include "core/config/ConfigFileManager.h"
 #include "core/config/ConfigValueIncludes.h"
 #include "MasterServerComm.h"
