Index: code/branches/core6/src/libraries/core/CMakeLists.txt
===================================================================
--- code/branches/core6/src/libraries/core/CMakeLists.txt	(revision 9557)
+++ code/branches/core6/src/libraries/core/CMakeLists.txt	(revision 9558)
@@ -23,5 +23,4 @@
   ClassTreeMask.cc
   CommandLineParser.cc
-  ConfigValueContainer.cc
   DynLib.cc
   DynLibManager.cc
@@ -55,5 +54,5 @@
 BUILD_UNIT FilesystemBuildUnit.cc
   command/ArgumentCompletionFunctions.cc
-  ConfigFileManager.cc
+  config/ConfigFileManager.cc
   PathConfig.cc
 END_BUILD_UNIT
@@ -67,4 +66,5 @@
 
 ADD_SUBDIRECTORY(command)
+ADD_SUBDIRECTORY(config)
 ADD_SUBDIRECTORY(input)
 ADD_SUBDIRECTORY(object)
@@ -74,5 +74,5 @@
   TOLUA_FILES
     command/CommandExecutor.h
-    ConfigFileManager.h
+    config/ConfigFileManager.h
     Game.h
     GameMode.h
Index: code/branches/core6/src/libraries/core/ConfigFileManager.cc
===================================================================
--- code/branches/core6/src/libraries/core/ConfigFileManager.cc	(revision 9557)
+++ 	(revision )
@@ -1,771 +1,0 @@
-/*
- *   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 ConfigFileManager and its helper classes.
-*/
-
-#include "ConfigFileManager.h"
-
-#include <boost/filesystem.hpp>
-
-#include "util/Convert.h"
-#include "util/Math.h"
-#include "util/StringUtils.h"
-#include "ConfigValueContainer.h"
-#include "PathConfig.h"
-#include "command/ConsoleCommand.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 //
-    ///////////////////////
-
-    ConfigFileManager* ConfigFileManager::singletonPtr_s = 0;
-
-    /// Constructor: Initializes the array of config files with NULL.
-    ConfigFileManager::ConfigFileManager()
-    {
-        this->configFiles_.assign(NULL);
-    }
-
-    /// Destructor: Deletes the config files.
-    ConfigFileManager::~ConfigFileManager()
-    {
-        for (boost::array<ConfigFile*, 3>::const_iterator it = this->configFiles_.begin(); it != this->configFiles_.end(); ++it)
-            if (*it)
-                delete (*it);
-    }
-
-    /// Defines the file-name for the config file of a given type (settings, calibration, etc.).
-    void ConfigFileManager::setFilename(ConfigFileType::Value type, const std::string& filename)
-    {
-        if (this->getConfigFile(type))
-            delete this->configFiles_[type];
-        // Create and load config file
-        switch (type)
-        {
-        case ConfigFileType::Settings:
-            this->configFiles_[type] = new SettingsConfigFile(filename);
-            break;
-        case ConfigFileType::JoyStickCalibration:
-        case ConfigFileType::CommandHistory:
-            this->configFiles_[type] = new ConfigFile(filename);
-            break;
-        }
-        this->configFiles_[type]->load();
-    }
-}
Index: code/branches/core6/src/libraries/core/ConfigFileManager.h
===================================================================
--- code/branches/core6/src/libraries/core/ConfigFileManager.h	(revision 9557)
+++ 	(revision )
@@ -1,602 +1,0 @@
-/*
- *   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
-    @brief Declaration of ConfigFileManager and its helper classes, used to load and save config files.
-*/
-
-#ifndef _ConfigFileManager_H__
-#define _ConfigFileManager_H__
-
-#include "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
-
-
-    ///////////////////////
-    // ConfigFileManager //
-    ///////////////////////
-    /**
-        @brief Manages the different config files (settings, calibration, etc). Implemented as Singleton.
-    */
-    class _CoreExport ConfigFileManager : public Singleton<ConfigFileManager>
-    {
-        friend class Singleton<ConfigFileManager>;
-        public:
-            ConfigFileManager();
-            ~ConfigFileManager();
-
-            void setFilename(ConfigFileType::Value type, const std::string& filename);
-
-            /// Returns the config file of a given type (settings, calibration, etc.)
-            inline ConfigFile* getConfigFile(ConfigFileType::Value type)
-            {
-                // Check array bounds
-                return configFiles_.at(type);
-            }
-
-        private:
-            ConfigFileManager(const ConfigFileManager&);    ///< Copy-constructor: not implemented
-
-            boost::array<ConfigFile*, 3> configFiles_;      ///< Stores the config files for each type in an array (must have the same size like ConfigFileType::Value)
-            static ConfigFileManager* singletonPtr_s;       ///< Stores the singleton-pointer
-    };
-} // tolua_export
-
-#endif /* _ConfigFileManager_H__ */
Index: code/branches/core6/src/libraries/core/ConfigValueContainer.cc
===================================================================
--- code/branches/core6/src/libraries/core/ConfigValueContainer.cc	(revision 9557)
+++ 	(revision )
@@ -1,352 +1,0 @@
-/*
- *   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 the ConfigValueContainer class.
-*/
-
-#include "ConfigValueContainer.h"
-
-#include "util/Convert.h"
-#include "util/SubString.h"
-#include "ConfigFileManager.h"
-#include "Language.h"
-
-namespace orxonox
-{
-    const unsigned int MAX_VECTOR_INDEX  = 255; // to avoid up to 4*10^9 vector entries in the config file after accidentally using a wrong argument
-
-    /**
-        @brief Initializes the ConfigValueContainer with default values.
-    */
-    void ConfigValueContainer::init(ConfigFileType::Value type, Identifier* identifier, const std::string& sectionname, const std::string& varname)
-    {
-        this->type_ = type;
-        this->identifier_ = identifier;
-        this->sectionname_ = sectionname;
-        this->varname_ = varname;
-        this->callback_ = 0;
-        this->bContainerIsNew_ = true;
-        this->bDoInitialCallback_ = false;
-        this->bAddedDescription_ = false;
-
-        // Register containers for general settings
-        if (this->type_ == ConfigFileType::Settings)
-            SettingsConfigFile::getInstance().addConfigValueContainer(this);
-    }
-
-    /**
-        @brief Does some special initialization for single config-values.
-    */
-    void ConfigValueContainer::initValue(const MultiType& defvalue)
-    {
-        this->value_ = defvalue;
-        this->bIsVector_ = false;
-
-        this->defvalueString_ = this->value_.get<std::string>();
-        this->update();
-    }
-
-    /**
-        @brief Does some special initialization for vector config-values.
-    */
-    void ConfigValueContainer::initVector()
-    {
-        this->bIsVector_ = true;
-
-        for (unsigned int i = 0; i < this->valueVector_.size(); i++)
-        {
-            ConfigFileManager::getInstance().getConfigFile(this->type_)->getOrCreateValue(this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isType<std::string>());
-            this->defvalueStringVector_.push_back(this->valueVector_[i]);
-        }
-
-        this->update();
-    }
-
-    /**
-        @brief Destructor: Deletes the callback object if necessary.
-    */
-    ConfigValueContainer::~ConfigValueContainer()
-    {
-        if (this->callback_)
-            delete this->callback_;
-
-        // Unregister general settings containers
-        if (this->type_ == ConfigFileType::Settings && SettingsConfigFile::exists())
-            SettingsConfigFile::getInstance().removeConfigValueContainer(this);
-    }
-
-    /**
-        @brief Assigns a new value to the config-value of all objects and writes the change into the config-file.
-        @param input The new value
-        @return True if the new value was successfully assigned
-    */
-    bool ConfigValueContainer::set(const MultiType& input)
-    {
-        if (this->bIsVector_)
-        {
-            return this->callFunctionWithIndex(&ConfigValueContainer::set, input);
-        }
-        else
-        {
-            if (this->tset(input))
-            {
-                ConfigFileManager::getInstance().getConfigFile(this->type_)->setValue(this->sectionname_, this->varname_, input, this->value_.isType<std::string>());
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-        @brief Assigns a new value to the config-value of all objects and writes the change into the config-file.
-        @param index The index in the vector
-        @param input The new value
-        @return True if the new value was successfully assigned
-    */
-    bool ConfigValueContainer::set(unsigned int index, const MultiType& input)
-    {
-        if (this->bIsVector_)
-        {
-            if (this->tset(index, input))
-            {
-                ConfigFileManager::getInstance().getConfigFile(this->type_)->setValue(this->sectionname_, this->varname_, index, input, this->value_.isType<std::string>());
-                return true;
-            }
-        }
-        else
-        {
-            orxout(user_error, context::config) << "Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << endl;
-        }
-        return false;
-    }
-
-    /**
-        @brief Assigns a new value to the config-value of all objects, but doesn't change the config-file (t stands for temporary).
-        @param input The new value. If bIsVector_ then write "index value"
-        @return True if the new value was successfully assigned
-    */
-    bool ConfigValueContainer::tset(const MultiType& input)
-    {
-        if (this->bIsVector_)
-        {
-            return this->callFunctionWithIndex(&ConfigValueContainer::tset, input);
-        }
-        else
-        {
-            this->value_ = input;
-
-            if (this->identifier_)
-                this->identifier_->updateConfigValues();
-
-            return true;
-        }
-    }
-
-    /**
-        @brief Assigns a new value to the config-value of all objects, but doesn't change the config-file (t stands for temporary).
-        @param index The index in the vector
-        @param input The new value
-        @return True if the new value was successfully assigned
-    */
-    bool ConfigValueContainer::tset(unsigned int index, const MultiType& input)
-    {
-        if (this->bIsVector_)
-        {
-            if (index > MAX_VECTOR_INDEX)
-            {
-                orxout(user_error, context::config) << "Index " << index << " is too large." << endl;
-                return false;
-            }
-
-            if (index >= this->valueVector_.size())
-            {
-                for (unsigned int i = this->valueVector_.size(); i <= index; i++)
-                {
-                    this->valueVector_.push_back(MultiType());
-                }
-            }
-
-            this->valueVector_[index] = input;
-
-            if (this->identifier_)
-                this->identifier_->updateConfigValues();
-
-            return true;
-        }
-        else
-        {
-            orxout(user_error, context::config) << "Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << endl;
-            return false;
-        }
-    }
-
-    /**
-        @brief Adds a new entry to the end of the vector.
-        @param input The new entry
-        @return True if the new entry was successfully added
-    */
-    bool ConfigValueContainer::add(const MultiType& input)
-    {
-        if (this->bIsVector_)
-            return this->set(this->valueVector_.size(), input);
-
-        orxout(user_error, context::config) << "Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << endl;
-        return false;
-    }
-
-    /**
-        @brief Removes an existing entry from the vector.
-        @param index The index of the entry
-        @return True if the entry was removed
-    */
-    bool ConfigValueContainer::remove(unsigned int index)
-    {
-        if (this->bIsVector_)
-        {
-            if (index < this->valueVector_.size())
-            {
-                // Erase the entry from the vector, change (shift) all entries beginning with index in the config file, remove the last entry from the file
-                this->valueVector_.erase(this->valueVector_.begin() + index);
-                for (unsigned int i = index; i < this->valueVector_.size(); i++)
-                    ConfigFileManager::getInstance().getConfigFile(this->type_)->setValue(this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isType<std::string>());
-                ConfigFileManager::getInstance().getConfigFile(this->type_)->deleteVectorEntries(this->sectionname_, this->varname_, this->valueVector_.size());
-
-                return true;
-            }
-            orxout(user_error, context::config) << "Invalid vector-index." << endl;
-        }
-
-        orxout(user_error, context::config) << "Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << endl;
-        return false;
-    }
-
-    /**
-        @brief Sets the value of the variable back to the default value and resets the config-file entry.
-    */
-    bool ConfigValueContainer::reset()
-    {
-        if (!this->bIsVector_)
-            return this->set(this->defvalueString_);
-        else
-        {
-            bool success = true;
-            for (unsigned int i = 0; i < this->defvalueStringVector_.size(); i++)
-                if (!this->set(i, this->defvalueStringVector_[i]))
-                    success = false;
-            ConfigFileManager::getInstance().getConfigFile(this->type_)->deleteVectorEntries(this->sectionname_, this->varname_, this->defvalueStringVector_.size());
-            return success;
-        }
-    }
-
-    /**
-        @brief Retrieves the configured value from the currently loaded config-file.
-    */
-    void ConfigValueContainer::update()
-    {
-        if (!this->bIsVector_)
-            this->value_ = ConfigFileManager::getInstance().getConfigFile(this->type_)->getOrCreateValue(this->sectionname_, this->varname_, this->defvalueString_, this->value_.isType<std::string>());
-        else
-        {
-            this->valueVector_.clear();
-            unsigned int vectorSize = ConfigFileManager::getInstance().getConfigFile(this->type_)->getVectorSize(this->sectionname_, this->varname_);
-            for (unsigned int i = 0; i < vectorSize; i++)
-            {
-                if (i < this->defvalueStringVector_.size())
-                {
-                    this->value_ = ConfigFileManager::getInstance().getConfigFile(this->type_)->getOrCreateValue(this->sectionname_, this->varname_, i, this->defvalueStringVector_[i], this->value_.isType<std::string>());
-                }
-                else
-                {
-                    this->value_ = ConfigFileManager::getInstance().getConfigFile(this->type_)->getOrCreateValue(this->sectionname_, this->varname_, i, MultiType(), this->value_.isType<std::string>());
-                }
-
-                this->valueVector_.push_back(this->value_);
-            }
-        }
-    }
-
-    /**
-        @brief Calls the given function with parsed index and the parsed argument from the input string.
-        @param function The function to call
-        @param input The input string
-        @return The returnvalue of the functioncall
-    */
-    bool ConfigValueContainer::callFunctionWithIndex(bool (ConfigValueContainer::* function) (unsigned int, const MultiType&), const std::string& input)
-    {
-        SubString token(input, " ", SubString::WhiteSpaces, true, '\\', false, '"', false, '\0', '\0', false, '\0');
-        int index = -1;
-        bool success = false;
-
-        if (token.size() > 0)
-            success = convertValue(&index, token[0]);
-
-        if (!success || index < 0 || index > (signed int)MAX_VECTOR_INDEX)
-        {
-            if (!success)
-            {
-                orxout(user_error, context::config) << "Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is a vector." << endl;
-            }
-            else
-            {
-                orxout(user_error, context::config) << "Invalid vector-index." << endl;
-            }
-            return false;
-        }
-
-        if (token.size() >= 2)
-            return (this->*function)(index, token.subSet(1).join());
-        else
-            return (this->*function)(index, "");
-    }
-
-    /**
-        @brief Adds a description to the config-value.
-        @param description The description
-    */
-    ConfigValueContainer& ConfigValueContainer::description(const std::string& description)
-    {
-        if (!this->bAddedDescription_)
-        {
-            this->description_ = std::string("ConfigValueDescription::" + this->sectionname_ + "::" + this->varname_);
-            AddLanguageEntry(this->description_, description);
-            this->bAddedDescription_ = true;
-        }
-        return (*this);
-    }
-
-    /**
-        @brief Returns the description of the config-value.
-        @return The description
-    */
-    const std::string& ConfigValueContainer::getDescription() const
-    {
-        return GetLocalisation(this->description_);
-    }
-}
Index: code/branches/core6/src/libraries/core/ConfigValueContainer.h
===================================================================
--- code/branches/core6/src/libraries/core/ConfigValueContainer.h	(revision 9557)
+++ 	(revision )
@@ -1,305 +1,0 @@
-/*
- *   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
-    @brief Declaration of the ConfigValueContainer class, caches a config-value.
-
-    The ConfigValueContainer class contains all needed information about a configurable variable:
-     - the name of the variable
-     - the name of the class the variable belongs to
-     - the default value
-     - the user-specified value
-     - a pointer to the entry in the config-file
-
-    This is needed to assign the configured values to all newly created objects.
-*/
-
-#ifndef _ConfigValueContainer_H__
-#define _ConfigValueContainer_H__
-
-#include "CorePrereqs.h"
-
-#include <string>
-#include <vector>
-
-#include "util/MultiType.h"
-#include "Identifier.h"
-
-namespace orxonox
-{
-    class ConfigValueCallbackBase
-    {
-        public:
-            virtual void call(void* object) = 0;
-            inline virtual ~ConfigValueCallbackBase() {}
-    };
-
-    template <class T>
-    class ConfigValueCallback: public ConfigValueCallbackBase
-    {
-        public:
-            inline ConfigValueCallback(void (T::*function) (void)) : function_(function) {}
-            inline virtual ~ConfigValueCallback() {}
-            inline virtual void call(void* object)
-            {
-                if (!Identifier::isCreatingHierarchy())
-                    (static_cast<T*>(object)->*this->function_)();
-            }
-
-        private:
-            void (T::*function_) (void);
-    };
-
-
-    /**
-        @brief The ConfigValuecontainer contains all needed information about a configurable variable.
-
-        The ConfigValueContainer class contains all needed information about a configurable variable:
-         - the name of the variable
-         - the name of the class the variable belongs to
-         - the default value
-         - the user-specified value
-         - a pointer to the entry in the config-file
-
-        This is needed to assign the configured values to all newly created objects.
-
-        The container searches for the entry in the config file.
-        If there is an entry, it parses the specified value and assigns it to the variable of the right type.
-        If there is no entry, it adds the entry with the default-value to the section of the variables class.
-        If there is no section, the section and the entry are added to the end of the config-file.
-    */
-    class _CoreExport ConfigValueContainer
-    {
-        public:
-            /**
-                @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
-                @param type The type of the corresponding config-file
-                @param identifier The identifier of the class the variable belongs to
-                @param sectionname Name of the section the configValue should be put in.
-                @param varname The name of the variable
-                @param defvalue The default-value
-                @param value Only needed do determine the right type.
-            */
-            template <class D, class V>
-            ConfigValueContainer(ConfigFileType::Value type, Identifier* identifier, const std::string& sectionname, const std::string& varname, const D& defvalue, const V&)
-            {
-                this->init(type, identifier, sectionname, varname);
-                this->initValue(static_cast<V>(defvalue));
-            }
-
-            /**
-                @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
-                @param type The type of the corresponding config-file
-                @param identifier The identifier of the class the variable belongs to
-                @param sectionname Name of the section the configValue should be put in.
-                @param varname The name of the variable
-                @param defvalue The default-value
-                @param value Only needed do determine the right type.
-            */
-            template <class D, class V>
-            ConfigValueContainer(ConfigFileType::Value type, Identifier* identifier, const std::string& sectionname, const std::string& varname, const std::vector<D>& defvalue, const std::vector<V>&)
-            {
-                this->init(type, identifier, sectionname, varname);
-
-                this->value_ = V();
-                for (unsigned int i = 0; i < defvalue.size(); i++)
-                    this->valueVector_.push_back(MultiType(defvalue[i]));
-
-                this->initVector();
-            }
-
-            ~ConfigValueContainer();
-
-            /**
-                @brief Returns the configured value.
-                @param value A pointer to the variable to store the value.
-                @param object The object calling this function
-                @return The ConfigValueContainer
-            */
-            template <typename T, class C>
-            ConfigValueContainer& getValue(T* value, C* object)
-            {
-                if ((this->callback_ && object) || this->bContainerIsNew_)
-                {
-                    T temp = *value;
-                    this->value_.getValue(value);
-                    if (this->bContainerIsNew_ || (*value) != temp)
-                    {
-                        this->bContainerIsNew_ = false;
-                        if (this->callback_ && object)
-                            this->callback_->call(object);
-                        else
-                            this->bDoInitialCallback_ = true;
-                    }
-                }
-                else
-                {
-                    this->value_.getValue(value);
-                }
-                return *this;
-            }
-
-            /**
-                @brief Returns the configured vector.
-                @param value A pointer to the vector to store the values.
-                @param object The object calling this function
-                @return The ConfigValueContainer
-            */
-            template <typename T, class C>
-            ConfigValueContainer& getValue(std::vector<T>* value, C* object)
-            {
-                if ((this->callback_ && object) || this->bContainerIsNew_)
-                {
-                    if (this->bContainerIsNew_)
-                        this->bContainerIsNew_ = false;
-
-                    std::vector<T> temp = *value;
-                    value->clear();
-                    for (unsigned int i = 0; i < this->valueVector_.size(); ++i)
-                        value->push_back(this->valueVector_[i]);
-
-                    if (value->size() != temp.size())
-                    {
-                        if (this->callback_ && object)
-                            this->callback_->call(object);
-                        else
-                            this->bDoInitialCallback_ = true;
-                    }
-                    else
-                    {
-                        for (unsigned int i = 0; i < value->size(); ++i)
-                        {
-                            if ((*value)[i] != temp[i])
-                            {
-                                if (this->callback_ && object)
-                                    this->callback_->call(object);
-                                else
-                                    this->bDoInitialCallback_ = true;
-                                break;
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    value->clear();
-                    for (unsigned int i = 0; i < this->valueVector_.size(); ++i)
-                        value->push_back(this->valueVector_[i]);
-                }
-                return *this;
-            }
-
-            /// Returns the name of this container.
-            inline const std::string& getName() const
-                { return this->varname_; }
-            /// Returns the name of the section this config value is in.
-            inline const std::string& getSectionName() const
-                { return this->sectionname_; }
-            /// Returns the associated identifier (can be NULL).
-            inline Identifier* getIdentifier() const
-                { return this->identifier_; }
-            /// Returns true if this config-value is a vector.
-            inline bool isVector() const
-                { return this->bIsVector_; }
-            /// Returns the vectors size (or zero if it's not a vector).
-            inline unsigned int getVectorSize() const
-                { return this->valueVector_.size(); }
-
-            ConfigValueContainer& description(const std::string& description);
-            const std::string& getDescription() const;
-
-            /**
-                @brief Adds a callback function, that gets called after getValue() if the newly assigned value differs from the old value of the variable.
-                @param object The object to call the function
-                @param function The callback function
-            */
-            template <class T>
-            inline ConfigValueContainer& callback(T* object, void (T::*function) (void))
-            {
-                if (!this->callback_)
-                {
-                    this->callback_ = new ConfigValueCallback<T>(function);
-
-                    if (this->bDoInitialCallback_)
-                    {
-                        this->bDoInitialCallback_ = false;
-                        this->callback_->call(object);
-                    }
-                }
-
-                return (*this);
-            }
-
-            bool set(const MultiType& input);
-            bool tset(const MultiType& input);
-
-            bool set(unsigned int index, const MultiType& input);
-            bool tset(unsigned int index, const MultiType& input);
-            bool add(const MultiType& input);
-            bool remove(unsigned int index);
-
-            bool reset();
-            void update();
-
-            /// Converts the config-value to a string.
-            inline std::string toString() const
-                { return this->value_; }
-            /// Returns the typename of the assigned config-value.
-            inline std::string getTypename() const
-                { return this->value_.getTypename(); }
-
-        private:
-            void init(ConfigFileType::Value type, Identifier* identifier, const std::string& sectionname, const std::string& varname);
-            void initValue(const MultiType& defvalue);
-            void initVector();
-            bool callFunctionWithIndex(bool (ConfigValueContainer::* function) (unsigned int, const MultiType&), const std::string& input);
-
-            bool                       bIsVector_;                  //!< True if the container contains a std::vector
-
-            ConfigFileType::Value      type_;                       //!< The type of the corresponding config-file
-            Identifier*                identifier_;                 //!< The identifier of the class
-            std::string                sectionname_;                //!< The name of the class the variable belongs to
-            std::string                varname_;                    //!< The name of the variable
-            std::string                defvalueString_;             //!< The string of the default-value
-            std::vector<std::string>   defvalueStringVector_;       //!< A vector, containg the strings of the default-values in case we're storing a vector
-
-            MultiType                  value_;                      //!< The value
-            std::vector<MultiType>     valueVector_;                //!< A vector, containg the values in case we're storing a vector
-
-            bool                       bAddedDescription_;          //!< True if a description was added
-            LanguageEntryLabel         description_;                //!< The description
-            ConfigValueCallbackBase*   callback_;                   //!< A callback function to call after getValue if the value changed
-
-            bool                       bContainerIsNew_;            //!< True if it's the first time getValue() gets called
-            bool                       bDoInitialCallback_;         //!< True if the callback should be called as soon as it gets created
-    };
-}
-
-#endif /* _ConfigValueContainer_H__ */
Index: code/branches/core6/src/libraries/core/ConfigValueIncludes.h
===================================================================
--- code/branches/core6/src/libraries/core/ConfigValueIncludes.h	(revision 9557)
+++ 	(revision )
@@ -1,272 +1,0 @@
-/*
- *   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:
- *      Reto Grieder (functions)
- *
- */
-
-/**
-    @defgroup ConfigFile Config file
-    @ingroup Config
-*/
-
-/**
-    @file
-    @ingroup Config ConfigFile
-    @brief Definition of macros and functions for config-values.
-
-    An example of how to use SetConfigValue():
-
-    Definition of a class in the header-file:
-    @code
-    class MyClass : public BaseObject
-    {
-        public:
-            MyClass();              // Constructor
-            void setConfigValues(); // Inherited function
-
-            const std::string& getName()
-                { return this->name_; }
-
-            float getVersion()
-                { return this->version_; }
-
-        private:
-            std::string name_;
-            float version_;
-    };
-    @endcode
-
-    Implementation of the class source-file:
-    @code
-    MyClass::MyClass()
-    {
-        // Macro-call to create an Identifier
-        RegisterObject(MyClass);
-
-        // Function-call to assign the config-values to the new object
-        this->setConfigValues();
-    }
-
-    void MyClass::setConfigValues()
-    {
-        SetConfigValue(name_, "Orxonox").description("The name of the game");
-        SetConfigValue(version_, "1.0").description("The version-number");
-    }
-    @endcode
-
-    Extract of orxonox.ini:
-    @code
-    [MyClass]
-    name_ = "Orxonox"
-    version_ = 1.1 // We have changed this value from 1.0 to 1.1
-    @endcode
-
-    Some other code:
-    @code
-    MyObject orxonoxobject;
-    orxout() << "Name:    " << orxonoxobject.getName() << endl;
-    orxout() << "Version: " << orxonoxobject.getVersion() << endl;
-    @endcode
-
-    Output:
-    @code
-    Name:    Orxonox
-    Version: 1.1
-    @endcode
-*/
-
-#ifndef _ConfigValueIncludes_H__
-#define _ConfigValueIncludes_H__
-
-#include "CorePrereqs.h"
-
-#include "Identifier.h"
-#include "ConfigValueContainer.h"
-
-namespace orxonox
-{
-    /** Sets a runtime configurable value.
-        If the container for the value doesn't yet exist, a new one is created.
-        Also, the @a variable argument will be modified and set to the new value (default or from ini file).
-    @param object
-        Class instance that the config value should belong to (usually just 'this')
-    @param variable
-        Pointer to the variable where the value should be written to
-    @param type
-        Type of the config file, usually ConfigFileType::Settings
-    @param sectionName
-        Name of the section in the ini file (e.g. [MySection])
-    @param entryName
-        Name of the entry in the ini file (e.g. [MySection] myValue)
-    @param defaultValue
-        Value to be used if it cannot be read from the ini file
-    */
-    template <class T, class D, class V>
-    inline ConfigValueContainer& setConfigValueGeneric(T* object, V* variable, ConfigFileType::Value type, const std::string& sectionName, const std::string& entryName, const D& defaultValue)
-    {
-        ConfigValueContainer* container = ClassIdentifier<T>::getIdentifier()->getConfigValueContainer(entryName);
-        if (!container)
-        {
-            container = new ConfigValueContainer(type, ClassIdentifier<T>::getIdentifier(), sectionName, entryName, defaultValue, *variable);
-            ClassIdentifier<T>::getIdentifier()->addConfigValueContainer(entryName, container);
-        }
-        return container->getValue(variable, object);
-    }
-}
-
-/** Sets a runtime configurable value (simplified macro version of setConfigValueGeneric)
-    If the container for the value doesn't yet exist, a new one is created.
-    Also, the @a varname argument will be modified and set to the new value (default or from ini file).
-@param varname
-    Variable name as C++ identifier. It will be used as entry name and as variable pointer
-@param defaultValue
-    Value to be used if it cannot be read from the ini file
-*/
-#define SetConfigValue(varname, defaultValue) \
-    orxonox::setConfigValueGeneric(this, &varname, ConfigFileType::Settings, this->getIdentifier()->getName(), #varname, defaultValue)
-
-/** Sets a runtime configurable value (simplified macro version of setConfigValueGeneric)
-    If the container for the value doesn't yet exist, a new one is created.
-    Also, the @a varname argument will be modified and set to the new value (default or from ini file).
-@param variable
-    Variable name as C++ identifier.
-@param entryName
-    Name of the entry in the ini file (e.g. [MySection] myValue)
-@param defaultValue
-    Value to be used if it cannot be read from the ini file
-*/
-#define SetConfigValueAlias(variable, entryName, defaultValue) \
-    orxonox::setConfigValueGeneric(this, &variable, ConfigFileType::Settings, this->getIdentifier()->getName(), entryName, defaultValue)
-
-/** Sets a runtime configurable value (simplified macro version of setConfigValueGeneric)
-    If the container for the value doesn't yet exist, a new one is created.
-    Also, the @a varname argument will be modified and set to the new value (default or from ini file).
-@param variable
-    Variable name as C++ identifier.
-@param sectionName
-    Name of the section in the ini file (e.g. [MySection])
-@param entryName
-    Name of the entry in the ini file (e.g. [MySection] myValue)
-@param defaultValue
-    Value to be used if it cannot be read from the ini file
-*/
-#define SetConfigValueExternal(variable, sectionName, entryName, defaultValue) \
-    orxonox::setConfigValueGeneric(this, &variable, ConfigFileType::Settings, sectionName, entryName, defaultValue)
-
-
-namespace orxonox
-{
-    /** Resets a runtime configurable value to its default.
-        If the container for the value doesn't yet exist, a warning is displayed.
-        Also, the @a variable argument will be modified and set to the default value.
-    @param object
-        Class instance that the config value should belong to (usually just 'this')
-    @param variable
-        Pointer to the variable where the value should be written to
-    @param entryName
-        Name of the entry in the ini file (e.g. [MySection] myValue)
-    */
-    template <class T, class V>
-    inline void resetConfigValueGeneric(T* object, V* variable, const std::string& entryName)
-    {
-        ConfigValueContainer* container = ClassIdentifier<T>::getIdentifier()->getConfigValueContainer(entryName);
-        if (container)
-        {
-            container->reset();
-            container->getValue(variable, object);
-        }
-        else
-        {
-            orxout(user_warning, context::config) << "Couldn't reset config-value '" << entryName << "' in class '"
-                                                  << ClassIdentifier<T>::getIdentifier()->getName() << "', corresponding container doesn't exist." << endl;
-        }
-    }
-}
-
-/** Resets a runtime configurable value to its default (simplified macro version of modifyConfigValueGeneric)
-    If the container for the value doesn't yet exist, a warning is displayed.
-    Also, the @a varname argument will be modified and set to the default value.
-@param varname
-    Variable name as C++ identifier. It will be used as entry name and as variable pointer
-*/
-#define ResetConfigValue(varname) \
-    orxonox::resetConfigValueGeneric(this, &varname, #varname)
-
-
-/** Modifies a runtime configurable value by using a modifier and some arguments.
-    If the container for the value doesn't yet exist, a warning is displayed.
-    Also, the @a variable argument will be modified and set to the current value.
-@param object
-    Class instance that the config value should belong to (usually just 'this')
-@param variable
-    Pointer to the variable where the value should be written to
-@param entryName
-    Name of the entry in the ini file (e.g. [MySection] myValue)
-@param modifier
-    On of these functions: set, tset, add, remove, reset, update
-@param ...
-    Arguments for the modifier function
-*/
-#define ModifyConfigValueGeneric(object, variable, entryName, modifier, ...) \
-    if (orxonox::ConfigValueContainer* container = ClassByObjectType(object)->getConfigValueContainer(entryName)) \
-    { \
-        container->modifier(__VA_ARGS__); \
-        container->getValue(variable, object); \
-    } \
-    else \
-    { \
-        orxout(user_warning, context::config) << "Couldn't modify config-value '" << entryName << "' in class '" \
-                                              << ClassByObjectType(object)->getName() << "', corresponding container doesn't exist." << endl; \
-    }
-
-/** Modifies a runtime configurable value by using a modifier and some arguments.
-    If the container for the value doesn't yet exist, a warning is displayed.
-    Also, the @a varname argument will be modified and set to the current value.
-@param varname
-    Variable name as C++ identifier. It will be used as entry name and as variable pointer
-@param modifier
-    On of these functions: set, tset, add, remove, reset, update
-@param ...
-    Arguments for the modifier function
-*/
-#define ModifyConfigValue(varname, modifier, ...) \
-    ModifyConfigValueGeneric(this, &varname, #varname, modifier, __VA_ARGS__)
-
-/** Modifies a runtime configurable value by using a modifier and some arguments.
-    If the container for the value doesn't yet exist, a warning is displayed.
-    Also, the @a variable argument will be modified and set to the current value.
-@param variable
-    Pointer to the variable where the value should be written to
-@param entryName
-    Name of the entry in the ini file (e.g. [MySection] myValue)
-@param modifier
-    On of these functions: set, tset, add, remove, reset, update
-@param ...
-    Arguments for the modifier function
-*/
-#define ModifyConfigValueExternal(variable, entryName, modifier, ...) \
-    ModifyConfigValueGeneric(this, &variable, entryName, modifier, __VA_ARGS__)
-
-#endif /* _ConfigValueIncludes_H__ */
Index: code/branches/core6/src/libraries/core/Core.cc
===================================================================
--- code/branches/core6/src/libraries/core/Core.cc	(revision 9557)
+++ code/branches/core6/src/libraries/core/Core.cc	(revision 9558)
@@ -61,6 +61,6 @@
 #include "PathConfig.h"
 #include "CommandLineParser.h"
-#include "ConfigFileManager.h"
-#include "ConfigValueIncludes.h"
+#include "config/ConfigFileManager.h"
+#include "config/ConfigValueIncludes.h"
 #include "CoreIncludes.h"
 #include "DynLibManager.h"
Index: code/branches/core6/src/libraries/core/GUIManager.cc
===================================================================
--- code/branches/core6/src/libraries/core/GUIManager.cc	(revision 9557)
+++ code/branches/core6/src/libraries/core/GUIManager.cc	(revision 9558)
@@ -78,5 +78,5 @@
 #include "util/OrxAssert.h"
 #include "util/output/BaseWriter.h"
-#include "ConfigValueIncludes.h"
+#include "config/ConfigValueIncludes.h"
 #include "Core.h"
 #include "CoreIncludes.h"
Index: code/branches/core6/src/libraries/core/Game.cc
===================================================================
--- code/branches/core6/src/libraries/core/Game.cc	(revision 9557)
+++ code/branches/core6/src/libraries/core/Game.cc	(revision 9558)
@@ -47,5 +47,5 @@
 #include "Core.h"
 #include "CoreIncludes.h"
-#include "ConfigValueIncludes.h"
+#include "config/ConfigValueIncludes.h"
 #include "GameMode.h"
 #include "GameState.h"
Index: code/branches/core6/src/libraries/core/GraphicsManager.cc
===================================================================
--- code/branches/core6/src/libraries/core/GraphicsManager.cc	(revision 9557)
+++ code/branches/core6/src/libraries/core/GraphicsManager.cc	(revision 9558)
@@ -52,5 +52,5 @@
 #include "util/StringUtils.h"
 #include "util/SubString.h"
-#include "ConfigValueIncludes.h"
+#include "config/ConfigValueIncludes.h"
 #include "CoreIncludes.h"
 #include "Core.h"
Index: code/branches/core6/src/libraries/core/Identifier.cc
===================================================================
--- code/branches/core6/src/libraries/core/Identifier.cc	(revision 9557)
+++ code/branches/core6/src/libraries/core/Identifier.cc	(revision 9558)
@@ -37,5 +37,5 @@
 
 #include "util/StringUtils.h"
-#include "ConfigValueContainer.h"
+#include "config/ConfigValueContainer.h"
 #include "XMLPort.h"
 #include "object/ClassFactory.h"
Index: code/branches/core6/src/libraries/core/command/ArgumentCompletionFunctions.cc
===================================================================
--- code/branches/core6/src/libraries/core/command/ArgumentCompletionFunctions.cc	(revision 9557)
+++ code/branches/core6/src/libraries/core/command/ArgumentCompletionFunctions.cc	(revision 9558)
@@ -40,6 +40,6 @@
 #include "util/StringUtils.h"
 #include "core/Identifier.h"
-#include "core/ConfigFileManager.h"
-#include "core/ConfigValueContainer.h"
+#include "core/config/ConfigFileManager.h"
+#include "core/config/ConfigValueContainer.h"
 #include "CommandExecutor.h"
 #include "ConsoleCommand.h"
Index: code/branches/core6/src/libraries/core/command/Shell.cc
===================================================================
--- code/branches/core6/src/libraries/core/command/Shell.cc	(revision 9557)
+++ code/branches/core6/src/libraries/core/command/Shell.cc	(revision 9558)
@@ -40,6 +40,6 @@
 #include "util/output/MemoryWriter.h"
 #include "core/CoreIncludes.h"
-#include "core/ConfigFileManager.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigFileManager.h"
+#include "core/config/ConfigValueIncludes.h"
 #include "core/PathConfig.h"
 #include "core/input/InputBuffer.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 9558)
@@ -0,0 +1,3 @@
+ADD_SOURCE_FILES(CORE_SRC_FILES
+  ConfigValueContainer.cc
+)
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 9558)
@@ -0,0 +1,771 @@
+/*
+ *   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 ConfigFileManager and its helper classes.
+*/
+
+#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"
+
+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 //
+    ///////////////////////
+
+    ConfigFileManager* ConfigFileManager::singletonPtr_s = 0;
+
+    /// Constructor: Initializes the array of config files with NULL.
+    ConfigFileManager::ConfigFileManager()
+    {
+        this->configFiles_.assign(NULL);
+    }
+
+    /// Destructor: Deletes the config files.
+    ConfigFileManager::~ConfigFileManager()
+    {
+        for (boost::array<ConfigFile*, 3>::const_iterator it = this->configFiles_.begin(); it != this->configFiles_.end(); ++it)
+            if (*it)
+                delete (*it);
+    }
+
+    /// Defines the file-name for the config file of a given type (settings, calibration, etc.).
+    void ConfigFileManager::setFilename(ConfigFileType::Value type, const std::string& filename)
+    {
+        if (this->getConfigFile(type))
+            delete this->configFiles_[type];
+        // Create and load config file
+        switch (type)
+        {
+        case ConfigFileType::Settings:
+            this->configFiles_[type] = new SettingsConfigFile(filename);
+            break;
+        case ConfigFileType::JoyStickCalibration:
+        case ConfigFileType::CommandHistory:
+            this->configFiles_[type] = new ConfigFile(filename);
+            break;
+        }
+        this->configFiles_[type]->load();
+    }
+}
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 9558)
@@ -0,0 +1,602 @@
+/*
+ *   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
+    @brief Declaration of ConfigFileManager and its helper classes, used to load and save config files.
+*/
+
+#ifndef _ConfigFileManager_H__
+#define _ConfigFileManager_H__
+
+#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
+
+
+    ///////////////////////
+    // ConfigFileManager //
+    ///////////////////////
+    /**
+        @brief Manages the different config files (settings, calibration, etc). Implemented as Singleton.
+    */
+    class _CoreExport ConfigFileManager : public Singleton<ConfigFileManager>
+    {
+        friend class Singleton<ConfigFileManager>;
+        public:
+            ConfigFileManager();
+            ~ConfigFileManager();
+
+            void setFilename(ConfigFileType::Value type, const std::string& filename);
+
+            /// Returns the config file of a given type (settings, calibration, etc.)
+            inline ConfigFile* getConfigFile(ConfigFileType::Value type)
+            {
+                // Check array bounds
+                return configFiles_.at(type);
+            }
+
+        private:
+            ConfigFileManager(const ConfigFileManager&);    ///< Copy-constructor: not implemented
+
+            boost::array<ConfigFile*, 3> configFiles_;      ///< Stores the config files for each type in an array (must have the same size like ConfigFileType::Value)
+            static ConfigFileManager* singletonPtr_s;       ///< Stores the singleton-pointer
+    };
+} // tolua_export
+
+#endif /* _ConfigFileManager_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 9558)
@@ -0,0 +1,352 @@
+/*
+ *   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 the ConfigValueContainer class.
+*/
+
+#include "ConfigValueContainer.h"
+
+#include "util/Convert.h"
+#include "util/SubString.h"
+#include "core/Language.h"
+#include "ConfigFileManager.h"
+
+namespace orxonox
+{
+    const unsigned int MAX_VECTOR_INDEX  = 255; // to avoid up to 4*10^9 vector entries in the config file after accidentally using a wrong argument
+
+    /**
+        @brief Initializes the ConfigValueContainer with default values.
+    */
+    void ConfigValueContainer::init(ConfigFileType::Value type, Identifier* identifier, const std::string& sectionname, const std::string& varname)
+    {
+        this->type_ = type;
+        this->identifier_ = identifier;
+        this->sectionname_ = sectionname;
+        this->varname_ = varname;
+        this->callback_ = 0;
+        this->bContainerIsNew_ = true;
+        this->bDoInitialCallback_ = false;
+        this->bAddedDescription_ = false;
+
+        // Register containers for general settings
+        if (this->type_ == ConfigFileType::Settings)
+            SettingsConfigFile::getInstance().addConfigValueContainer(this);
+    }
+
+    /**
+        @brief Does some special initialization for single config-values.
+    */
+    void ConfigValueContainer::initValue(const MultiType& defvalue)
+    {
+        this->value_ = defvalue;
+        this->bIsVector_ = false;
+
+        this->defvalueString_ = this->value_.get<std::string>();
+        this->update();
+    }
+
+    /**
+        @brief Does some special initialization for vector config-values.
+    */
+    void ConfigValueContainer::initVector()
+    {
+        this->bIsVector_ = true;
+
+        for (unsigned int i = 0; i < this->valueVector_.size(); i++)
+        {
+            ConfigFileManager::getInstance().getConfigFile(this->type_)->getOrCreateValue(this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isType<std::string>());
+            this->defvalueStringVector_.push_back(this->valueVector_[i]);
+        }
+
+        this->update();
+    }
+
+    /**
+        @brief Destructor: Deletes the callback object if necessary.
+    */
+    ConfigValueContainer::~ConfigValueContainer()
+    {
+        if (this->callback_)
+            delete this->callback_;
+
+        // Unregister general settings containers
+        if (this->type_ == ConfigFileType::Settings && SettingsConfigFile::exists())
+            SettingsConfigFile::getInstance().removeConfigValueContainer(this);
+    }
+
+    /**
+        @brief Assigns a new value to the config-value of all objects and writes the change into the config-file.
+        @param input The new value
+        @return True if the new value was successfully assigned
+    */
+    bool ConfigValueContainer::set(const MultiType& input)
+    {
+        if (this->bIsVector_)
+        {
+            return this->callFunctionWithIndex(&ConfigValueContainer::set, input);
+        }
+        else
+        {
+            if (this->tset(input))
+            {
+                ConfigFileManager::getInstance().getConfigFile(this->type_)->setValue(this->sectionname_, this->varname_, input, this->value_.isType<std::string>());
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+        @brief Assigns a new value to the config-value of all objects and writes the change into the config-file.
+        @param index The index in the vector
+        @param input The new value
+        @return True if the new value was successfully assigned
+    */
+    bool ConfigValueContainer::set(unsigned int index, const MultiType& input)
+    {
+        if (this->bIsVector_)
+        {
+            if (this->tset(index, input))
+            {
+                ConfigFileManager::getInstance().getConfigFile(this->type_)->setValue(this->sectionname_, this->varname_, index, input, this->value_.isType<std::string>());
+                return true;
+            }
+        }
+        else
+        {
+            orxout(user_error, context::config) << "Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << endl;
+        }
+        return false;
+    }
+
+    /**
+        @brief Assigns a new value to the config-value of all objects, but doesn't change the config-file (t stands for temporary).
+        @param input The new value. If bIsVector_ then write "index value"
+        @return True if the new value was successfully assigned
+    */
+    bool ConfigValueContainer::tset(const MultiType& input)
+    {
+        if (this->bIsVector_)
+        {
+            return this->callFunctionWithIndex(&ConfigValueContainer::tset, input);
+        }
+        else
+        {
+            this->value_ = input;
+
+            if (this->identifier_)
+                this->identifier_->updateConfigValues();
+
+            return true;
+        }
+    }
+
+    /**
+        @brief Assigns a new value to the config-value of all objects, but doesn't change the config-file (t stands for temporary).
+        @param index The index in the vector
+        @param input The new value
+        @return True if the new value was successfully assigned
+    */
+    bool ConfigValueContainer::tset(unsigned int index, const MultiType& input)
+    {
+        if (this->bIsVector_)
+        {
+            if (index > MAX_VECTOR_INDEX)
+            {
+                orxout(user_error, context::config) << "Index " << index << " is too large." << endl;
+                return false;
+            }
+
+            if (index >= this->valueVector_.size())
+            {
+                for (unsigned int i = this->valueVector_.size(); i <= index; i++)
+                {
+                    this->valueVector_.push_back(MultiType());
+                }
+            }
+
+            this->valueVector_[index] = input;
+
+            if (this->identifier_)
+                this->identifier_->updateConfigValues();
+
+            return true;
+        }
+        else
+        {
+            orxout(user_error, context::config) << "Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << endl;
+            return false;
+        }
+    }
+
+    /**
+        @brief Adds a new entry to the end of the vector.
+        @param input The new entry
+        @return True if the new entry was successfully added
+    */
+    bool ConfigValueContainer::add(const MultiType& input)
+    {
+        if (this->bIsVector_)
+            return this->set(this->valueVector_.size(), input);
+
+        orxout(user_error, context::config) << "Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << endl;
+        return false;
+    }
+
+    /**
+        @brief Removes an existing entry from the vector.
+        @param index The index of the entry
+        @return True if the entry was removed
+    */
+    bool ConfigValueContainer::remove(unsigned int index)
+    {
+        if (this->bIsVector_)
+        {
+            if (index < this->valueVector_.size())
+            {
+                // Erase the entry from the vector, change (shift) all entries beginning with index in the config file, remove the last entry from the file
+                this->valueVector_.erase(this->valueVector_.begin() + index);
+                for (unsigned int i = index; i < this->valueVector_.size(); i++)
+                    ConfigFileManager::getInstance().getConfigFile(this->type_)->setValue(this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isType<std::string>());
+                ConfigFileManager::getInstance().getConfigFile(this->type_)->deleteVectorEntries(this->sectionname_, this->varname_, this->valueVector_.size());
+
+                return true;
+            }
+            orxout(user_error, context::config) << "Invalid vector-index." << endl;
+        }
+
+        orxout(user_error, context::config) << "Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << endl;
+        return false;
+    }
+
+    /**
+        @brief Sets the value of the variable back to the default value and resets the config-file entry.
+    */
+    bool ConfigValueContainer::reset()
+    {
+        if (!this->bIsVector_)
+            return this->set(this->defvalueString_);
+        else
+        {
+            bool success = true;
+            for (unsigned int i = 0; i < this->defvalueStringVector_.size(); i++)
+                if (!this->set(i, this->defvalueStringVector_[i]))
+                    success = false;
+            ConfigFileManager::getInstance().getConfigFile(this->type_)->deleteVectorEntries(this->sectionname_, this->varname_, this->defvalueStringVector_.size());
+            return success;
+        }
+    }
+
+    /**
+        @brief Retrieves the configured value from the currently loaded config-file.
+    */
+    void ConfigValueContainer::update()
+    {
+        if (!this->bIsVector_)
+            this->value_ = ConfigFileManager::getInstance().getConfigFile(this->type_)->getOrCreateValue(this->sectionname_, this->varname_, this->defvalueString_, this->value_.isType<std::string>());
+        else
+        {
+            this->valueVector_.clear();
+            unsigned int vectorSize = ConfigFileManager::getInstance().getConfigFile(this->type_)->getVectorSize(this->sectionname_, this->varname_);
+            for (unsigned int i = 0; i < vectorSize; i++)
+            {
+                if (i < this->defvalueStringVector_.size())
+                {
+                    this->value_ = ConfigFileManager::getInstance().getConfigFile(this->type_)->getOrCreateValue(this->sectionname_, this->varname_, i, this->defvalueStringVector_[i], this->value_.isType<std::string>());
+                }
+                else
+                {
+                    this->value_ = ConfigFileManager::getInstance().getConfigFile(this->type_)->getOrCreateValue(this->sectionname_, this->varname_, i, MultiType(), this->value_.isType<std::string>());
+                }
+
+                this->valueVector_.push_back(this->value_);
+            }
+        }
+    }
+
+    /**
+        @brief Calls the given function with parsed index and the parsed argument from the input string.
+        @param function The function to call
+        @param input The input string
+        @return The returnvalue of the functioncall
+    */
+    bool ConfigValueContainer::callFunctionWithIndex(bool (ConfigValueContainer::* function) (unsigned int, const MultiType&), const std::string& input)
+    {
+        SubString token(input, " ", SubString::WhiteSpaces, true, '\\', false, '"', false, '\0', '\0', false, '\0');
+        int index = -1;
+        bool success = false;
+
+        if (token.size() > 0)
+            success = convertValue(&index, token[0]);
+
+        if (!success || index < 0 || index > (signed int)MAX_VECTOR_INDEX)
+        {
+            if (!success)
+            {
+                orxout(user_error, context::config) << "Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is a vector." << endl;
+            }
+            else
+            {
+                orxout(user_error, context::config) << "Invalid vector-index." << endl;
+            }
+            return false;
+        }
+
+        if (token.size() >= 2)
+            return (this->*function)(index, token.subSet(1).join());
+        else
+            return (this->*function)(index, "");
+    }
+
+    /**
+        @brief Adds a description to the config-value.
+        @param description The description
+    */
+    ConfigValueContainer& ConfigValueContainer::description(const std::string& description)
+    {
+        if (!this->bAddedDescription_)
+        {
+            this->description_ = std::string("ConfigValueDescription::" + this->sectionname_ + "::" + this->varname_);
+            AddLanguageEntry(this->description_, description);
+            this->bAddedDescription_ = true;
+        }
+        return (*this);
+    }
+
+    /**
+        @brief Returns the description of the config-value.
+        @return The description
+    */
+    const std::string& ConfigValueContainer::getDescription() const
+    {
+        return GetLocalisation(this->description_);
+    }
+}
Index: code/branches/core6/src/libraries/core/config/ConfigValueContainer.h
===================================================================
--- code/branches/core6/src/libraries/core/config/ConfigValueContainer.h	(revision 9558)
+++ code/branches/core6/src/libraries/core/config/ConfigValueContainer.h	(revision 9558)
@@ -0,0 +1,305 @@
+/*
+ *   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
+    @brief Declaration of the ConfigValueContainer class, caches a config-value.
+
+    The ConfigValueContainer class contains all needed information about a configurable variable:
+     - the name of the variable
+     - the name of the class the variable belongs to
+     - the default value
+     - the user-specified value
+     - a pointer to the entry in the config-file
+
+    This is needed to assign the configured values to all newly created objects.
+*/
+
+#ifndef _ConfigValueContainer_H__
+#define _ConfigValueContainer_H__
+
+#include "core/CorePrereqs.h"
+
+#include <string>
+#include <vector>
+
+#include "util/MultiType.h"
+#include "core/Identifier.h"
+
+namespace orxonox
+{
+    class ConfigValueCallbackBase
+    {
+        public:
+            virtual void call(void* object) = 0;
+            inline virtual ~ConfigValueCallbackBase() {}
+    };
+
+    template <class T>
+    class ConfigValueCallback: public ConfigValueCallbackBase
+    {
+        public:
+            inline ConfigValueCallback(void (T::*function) (void)) : function_(function) {}
+            inline virtual ~ConfigValueCallback() {}
+            inline virtual void call(void* object)
+            {
+                if (!Identifier::isCreatingHierarchy())
+                    (static_cast<T*>(object)->*this->function_)();
+            }
+
+        private:
+            void (T::*function_) (void);
+    };
+
+
+    /**
+        @brief The ConfigValuecontainer contains all needed information about a configurable variable.
+
+        The ConfigValueContainer class contains all needed information about a configurable variable:
+         - the name of the variable
+         - the name of the class the variable belongs to
+         - the default value
+         - the user-specified value
+         - a pointer to the entry in the config-file
+
+        This is needed to assign the configured values to all newly created objects.
+
+        The container searches for the entry in the config file.
+        If there is an entry, it parses the specified value and assigns it to the variable of the right type.
+        If there is no entry, it adds the entry with the default-value to the section of the variables class.
+        If there is no section, the section and the entry are added to the end of the config-file.
+    */
+    class _CoreExport ConfigValueContainer
+    {
+        public:
+            /**
+                @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
+                @param type The type of the corresponding config-file
+                @param identifier The identifier of the class the variable belongs to
+                @param sectionname Name of the section the configValue should be put in.
+                @param varname The name of the variable
+                @param defvalue The default-value
+                @param value Only needed do determine the right type.
+            */
+            template <class D, class V>
+            ConfigValueContainer(ConfigFileType::Value type, Identifier* identifier, const std::string& sectionname, const std::string& varname, const D& defvalue, const V&)
+            {
+                this->init(type, identifier, sectionname, varname);
+                this->initValue(static_cast<V>(defvalue));
+            }
+
+            /**
+                @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
+                @param type The type of the corresponding config-file
+                @param identifier The identifier of the class the variable belongs to
+                @param sectionname Name of the section the configValue should be put in.
+                @param varname The name of the variable
+                @param defvalue The default-value
+                @param value Only needed do determine the right type.
+            */
+            template <class D, class V>
+            ConfigValueContainer(ConfigFileType::Value type, Identifier* identifier, const std::string& sectionname, const std::string& varname, const std::vector<D>& defvalue, const std::vector<V>&)
+            {
+                this->init(type, identifier, sectionname, varname);
+
+                this->value_ = V();
+                for (unsigned int i = 0; i < defvalue.size(); i++)
+                    this->valueVector_.push_back(MultiType(defvalue[i]));
+
+                this->initVector();
+            }
+
+            ~ConfigValueContainer();
+
+            /**
+                @brief Returns the configured value.
+                @param value A pointer to the variable to store the value.
+                @param object The object calling this function
+                @return The ConfigValueContainer
+            */
+            template <typename T, class C>
+            ConfigValueContainer& getValue(T* value, C* object)
+            {
+                if ((this->callback_ && object) || this->bContainerIsNew_)
+                {
+                    T temp = *value;
+                    this->value_.getValue(value);
+                    if (this->bContainerIsNew_ || (*value) != temp)
+                    {
+                        this->bContainerIsNew_ = false;
+                        if (this->callback_ && object)
+                            this->callback_->call(object);
+                        else
+                            this->bDoInitialCallback_ = true;
+                    }
+                }
+                else
+                {
+                    this->value_.getValue(value);
+                }
+                return *this;
+            }
+
+            /**
+                @brief Returns the configured vector.
+                @param value A pointer to the vector to store the values.
+                @param object The object calling this function
+                @return The ConfigValueContainer
+            */
+            template <typename T, class C>
+            ConfigValueContainer& getValue(std::vector<T>* value, C* object)
+            {
+                if ((this->callback_ && object) || this->bContainerIsNew_)
+                {
+                    if (this->bContainerIsNew_)
+                        this->bContainerIsNew_ = false;
+
+                    std::vector<T> temp = *value;
+                    value->clear();
+                    for (unsigned int i = 0; i < this->valueVector_.size(); ++i)
+                        value->push_back(this->valueVector_[i]);
+
+                    if (value->size() != temp.size())
+                    {
+                        if (this->callback_ && object)
+                            this->callback_->call(object);
+                        else
+                            this->bDoInitialCallback_ = true;
+                    }
+                    else
+                    {
+                        for (unsigned int i = 0; i < value->size(); ++i)
+                        {
+                            if ((*value)[i] != temp[i])
+                            {
+                                if (this->callback_ && object)
+                                    this->callback_->call(object);
+                                else
+                                    this->bDoInitialCallback_ = true;
+                                break;
+                            }
+                        }
+                    }
+                }
+                else
+                {
+                    value->clear();
+                    for (unsigned int i = 0; i < this->valueVector_.size(); ++i)
+                        value->push_back(this->valueVector_[i]);
+                }
+                return *this;
+            }
+
+            /// Returns the name of this container.
+            inline const std::string& getName() const
+                { return this->varname_; }
+            /// Returns the name of the section this config value is in.
+            inline const std::string& getSectionName() const
+                { return this->sectionname_; }
+            /// Returns the associated identifier (can be NULL).
+            inline Identifier* getIdentifier() const
+                { return this->identifier_; }
+            /// Returns true if this config-value is a vector.
+            inline bool isVector() const
+                { return this->bIsVector_; }
+            /// Returns the vectors size (or zero if it's not a vector).
+            inline unsigned int getVectorSize() const
+                { return this->valueVector_.size(); }
+
+            ConfigValueContainer& description(const std::string& description);
+            const std::string& getDescription() const;
+
+            /**
+                @brief Adds a callback function, that gets called after getValue() if the newly assigned value differs from the old value of the variable.
+                @param object The object to call the function
+                @param function The callback function
+            */
+            template <class T>
+            inline ConfigValueContainer& callback(T* object, void (T::*function) (void))
+            {
+                if (!this->callback_)
+                {
+                    this->callback_ = new ConfigValueCallback<T>(function);
+
+                    if (this->bDoInitialCallback_)
+                    {
+                        this->bDoInitialCallback_ = false;
+                        this->callback_->call(object);
+                    }
+                }
+
+                return (*this);
+            }
+
+            bool set(const MultiType& input);
+            bool tset(const MultiType& input);
+
+            bool set(unsigned int index, const MultiType& input);
+            bool tset(unsigned int index, const MultiType& input);
+            bool add(const MultiType& input);
+            bool remove(unsigned int index);
+
+            bool reset();
+            void update();
+
+            /// Converts the config-value to a string.
+            inline std::string toString() const
+                { return this->value_; }
+            /// Returns the typename of the assigned config-value.
+            inline std::string getTypename() const
+                { return this->value_.getTypename(); }
+
+        private:
+            void init(ConfigFileType::Value type, Identifier* identifier, const std::string& sectionname, const std::string& varname);
+            void initValue(const MultiType& defvalue);
+            void initVector();
+            bool callFunctionWithIndex(bool (ConfigValueContainer::* function) (unsigned int, const MultiType&), const std::string& input);
+
+            bool                       bIsVector_;                  //!< True if the container contains a std::vector
+
+            ConfigFileType::Value      type_;                       //!< The type of the corresponding config-file
+            Identifier*                identifier_;                 //!< The identifier of the class
+            std::string                sectionname_;                //!< The name of the class the variable belongs to
+            std::string                varname_;                    //!< The name of the variable
+            std::string                defvalueString_;             //!< The string of the default-value
+            std::vector<std::string>   defvalueStringVector_;       //!< A vector, containg the strings of the default-values in case we're storing a vector
+
+            MultiType                  value_;                      //!< The value
+            std::vector<MultiType>     valueVector_;                //!< A vector, containg the values in case we're storing a vector
+
+            bool                       bAddedDescription_;          //!< True if a description was added
+            LanguageEntryLabel         description_;                //!< The description
+            ConfigValueCallbackBase*   callback_;                   //!< A callback function to call after getValue if the value changed
+
+            bool                       bContainerIsNew_;            //!< True if it's the first time getValue() gets called
+            bool                       bDoInitialCallback_;         //!< True if the callback should be called as soon as it gets created
+    };
+}
+
+#endif /* _ConfigValueContainer_H__ */
Index: code/branches/core6/src/libraries/core/config/ConfigValueIncludes.h
===================================================================
--- code/branches/core6/src/libraries/core/config/ConfigValueIncludes.h	(revision 9558)
+++ code/branches/core6/src/libraries/core/config/ConfigValueIncludes.h	(revision 9558)
@@ -0,0 +1,272 @@
+/*
+ *   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:
+ *      Reto Grieder (functions)
+ *
+ */
+
+/**
+    @defgroup ConfigFile Config file
+    @ingroup Config
+*/
+
+/**
+    @file
+    @ingroup Config ConfigFile
+    @brief Definition of macros and functions for config-values.
+
+    An example of how to use SetConfigValue():
+
+    Definition of a class in the header-file:
+    @code
+    class MyClass : public BaseObject
+    {
+        public:
+            MyClass();              // Constructor
+            void setConfigValues(); // Inherited function
+
+            const std::string& getName()
+                { return this->name_; }
+
+            float getVersion()
+                { return this->version_; }
+
+        private:
+            std::string name_;
+            float version_;
+    };
+    @endcode
+
+    Implementation of the class source-file:
+    @code
+    MyClass::MyClass()
+    {
+        // Macro-call to create an Identifier
+        RegisterObject(MyClass);
+
+        // Function-call to assign the config-values to the new object
+        this->setConfigValues();
+    }
+
+    void MyClass::setConfigValues()
+    {
+        SetConfigValue(name_, "Orxonox").description("The name of the game");
+        SetConfigValue(version_, "1.0").description("The version-number");
+    }
+    @endcode
+
+    Extract of orxonox.ini:
+    @code
+    [MyClass]
+    name_ = "Orxonox"
+    version_ = 1.1 // We have changed this value from 1.0 to 1.1
+    @endcode
+
+    Some other code:
+    @code
+    MyObject orxonoxobject;
+    orxout() << "Name:    " << orxonoxobject.getName() << endl;
+    orxout() << "Version: " << orxonoxobject.getVersion() << endl;
+    @endcode
+
+    Output:
+    @code
+    Name:    Orxonox
+    Version: 1.1
+    @endcode
+*/
+
+#ifndef _ConfigValueIncludes_H__
+#define _ConfigValueIncludes_H__
+
+#include "core/CorePrereqs.h"
+
+#include "core/Identifier.h"
+#include "ConfigValueContainer.h"
+
+namespace orxonox
+{
+    /** Sets a runtime configurable value.
+        If the container for the value doesn't yet exist, a new one is created.
+        Also, the @a variable argument will be modified and set to the new value (default or from ini file).
+    @param object
+        Class instance that the config value should belong to (usually just 'this')
+    @param variable
+        Pointer to the variable where the value should be written to
+    @param type
+        Type of the config file, usually ConfigFileType::Settings
+    @param sectionName
+        Name of the section in the ini file (e.g. [MySection])
+    @param entryName
+        Name of the entry in the ini file (e.g. [MySection] myValue)
+    @param defaultValue
+        Value to be used if it cannot be read from the ini file
+    */
+    template <class T, class D, class V>
+    inline ConfigValueContainer& setConfigValueGeneric(T* object, V* variable, ConfigFileType::Value type, const std::string& sectionName, const std::string& entryName, const D& defaultValue)
+    {
+        ConfigValueContainer* container = ClassIdentifier<T>::getIdentifier()->getConfigValueContainer(entryName);
+        if (!container)
+        {
+            container = new ConfigValueContainer(type, ClassIdentifier<T>::getIdentifier(), sectionName, entryName, defaultValue, *variable);
+            ClassIdentifier<T>::getIdentifier()->addConfigValueContainer(entryName, container);
+        }
+        return container->getValue(variable, object);
+    }
+}
+
+/** Sets a runtime configurable value (simplified macro version of setConfigValueGeneric)
+    If the container for the value doesn't yet exist, a new one is created.
+    Also, the @a varname argument will be modified and set to the new value (default or from ini file).
+@param varname
+    Variable name as C++ identifier. It will be used as entry name and as variable pointer
+@param defaultValue
+    Value to be used if it cannot be read from the ini file
+*/
+#define SetConfigValue(varname, defaultValue) \
+    orxonox::setConfigValueGeneric(this, &varname, ConfigFileType::Settings, this->getIdentifier()->getName(), #varname, defaultValue)
+
+/** Sets a runtime configurable value (simplified macro version of setConfigValueGeneric)
+    If the container for the value doesn't yet exist, a new one is created.
+    Also, the @a varname argument will be modified and set to the new value (default or from ini file).
+@param variable
+    Variable name as C++ identifier.
+@param entryName
+    Name of the entry in the ini file (e.g. [MySection] myValue)
+@param defaultValue
+    Value to be used if it cannot be read from the ini file
+*/
+#define SetConfigValueAlias(variable, entryName, defaultValue) \
+    orxonox::setConfigValueGeneric(this, &variable, ConfigFileType::Settings, this->getIdentifier()->getName(), entryName, defaultValue)
+
+/** Sets a runtime configurable value (simplified macro version of setConfigValueGeneric)
+    If the container for the value doesn't yet exist, a new one is created.
+    Also, the @a varname argument will be modified and set to the new value (default or from ini file).
+@param variable
+    Variable name as C++ identifier.
+@param sectionName
+    Name of the section in the ini file (e.g. [MySection])
+@param entryName
+    Name of the entry in the ini file (e.g. [MySection] myValue)
+@param defaultValue
+    Value to be used if it cannot be read from the ini file
+*/
+#define SetConfigValueExternal(variable, sectionName, entryName, defaultValue) \
+    orxonox::setConfigValueGeneric(this, &variable, ConfigFileType::Settings, sectionName, entryName, defaultValue)
+
+
+namespace orxonox
+{
+    /** Resets a runtime configurable value to its default.
+        If the container for the value doesn't yet exist, a warning is displayed.
+        Also, the @a variable argument will be modified and set to the default value.
+    @param object
+        Class instance that the config value should belong to (usually just 'this')
+    @param variable
+        Pointer to the variable where the value should be written to
+    @param entryName
+        Name of the entry in the ini file (e.g. [MySection] myValue)
+    */
+    template <class T, class V>
+    inline void resetConfigValueGeneric(T* object, V* variable, const std::string& entryName)
+    {
+        ConfigValueContainer* container = ClassIdentifier<T>::getIdentifier()->getConfigValueContainer(entryName);
+        if (container)
+        {
+            container->reset();
+            container->getValue(variable, object);
+        }
+        else
+        {
+            orxout(user_warning, context::config) << "Couldn't reset config-value '" << entryName << "' in class '"
+                                                  << ClassIdentifier<T>::getIdentifier()->getName() << "', corresponding container doesn't exist." << endl;
+        }
+    }
+}
+
+/** Resets a runtime configurable value to its default (simplified macro version of modifyConfigValueGeneric)
+    If the container for the value doesn't yet exist, a warning is displayed.
+    Also, the @a varname argument will be modified and set to the default value.
+@param varname
+    Variable name as C++ identifier. It will be used as entry name and as variable pointer
+*/
+#define ResetConfigValue(varname) \
+    orxonox::resetConfigValueGeneric(this, &varname, #varname)
+
+
+/** Modifies a runtime configurable value by using a modifier and some arguments.
+    If the container for the value doesn't yet exist, a warning is displayed.
+    Also, the @a variable argument will be modified and set to the current value.
+@param object
+    Class instance that the config value should belong to (usually just 'this')
+@param variable
+    Pointer to the variable where the value should be written to
+@param entryName
+    Name of the entry in the ini file (e.g. [MySection] myValue)
+@param modifier
+    On of these functions: set, tset, add, remove, reset, update
+@param ...
+    Arguments for the modifier function
+*/
+#define ModifyConfigValueGeneric(object, variable, entryName, modifier, ...) \
+    if (orxonox::ConfigValueContainer* container = ClassByObjectType(object)->getConfigValueContainer(entryName)) \
+    { \
+        container->modifier(__VA_ARGS__); \
+        container->getValue(variable, object); \
+    } \
+    else \
+    { \
+        orxout(user_warning, context::config) << "Couldn't modify config-value '" << entryName << "' in class '" \
+                                              << ClassByObjectType(object)->getName() << "', corresponding container doesn't exist." << endl; \
+    }
+
+/** Modifies a runtime configurable value by using a modifier and some arguments.
+    If the container for the value doesn't yet exist, a warning is displayed.
+    Also, the @a varname argument will be modified and set to the current value.
+@param varname
+    Variable name as C++ identifier. It will be used as entry name and as variable pointer
+@param modifier
+    On of these functions: set, tset, add, remove, reset, update
+@param ...
+    Arguments for the modifier function
+*/
+#define ModifyConfigValue(varname, modifier, ...) \
+    ModifyConfigValueGeneric(this, &varname, #varname, modifier, __VA_ARGS__)
+
+/** Modifies a runtime configurable value by using a modifier and some arguments.
+    If the container for the value doesn't yet exist, a warning is displayed.
+    Also, the @a variable argument will be modified and set to the current value.
+@param variable
+    Pointer to the variable where the value should be written to
+@param entryName
+    Name of the entry in the ini file (e.g. [MySection] myValue)
+@param modifier
+    On of these functions: set, tset, add, remove, reset, update
+@param ...
+    Arguments for the modifier function
+*/
+#define ModifyConfigValueExternal(variable, entryName, modifier, ...) \
+    ModifyConfigValueGeneric(this, &variable, entryName, modifier, __VA_ARGS__)
+
+#endif /* _ConfigValueIncludes_H__ */
Index: code/branches/core6/src/libraries/core/input/Button.cc
===================================================================
--- code/branches/core6/src/libraries/core/input/Button.cc	(revision 9557)
+++ code/branches/core6/src/libraries/core/input/Button.cc	(revision 9558)
@@ -42,5 +42,5 @@
 #include "core/command/CommandEvaluation.h"
 #include "core/command/CommandExecutor.h"
-#include "core/ConfigFileManager.h"
+#include "core/config/ConfigFileManager.h"
 
 namespace orxonox
Index: code/branches/core6/src/libraries/core/input/InputBuffer.cc
===================================================================
--- code/branches/core6/src/libraries/core/input/InputBuffer.cc	(revision 9557)
+++ code/branches/core6/src/libraries/core/input/InputBuffer.cc	(revision 9558)
@@ -31,5 +31,5 @@
 #include "util/Clipboard.h"
 #include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
 
 namespace orxonox
Index: code/branches/core6/src/libraries/core/input/InputManager.cc
===================================================================
--- code/branches/core6/src/libraries/core/input/InputManager.cc	(revision 9557)
+++ code/branches/core6/src/libraries/core/input/InputManager.cc	(revision 9558)
@@ -46,5 +46,5 @@
 #include "util/Exception.h"
 #include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
 #include "core/CommandLineParser.h"
 #include "core/GraphicsManager.h"
Index: code/branches/core6/src/libraries/core/input/JoyStick.cc
===================================================================
--- code/branches/core6/src/libraries/core/input/JoyStick.cc	(revision 9557)
+++ code/branches/core6/src/libraries/core/input/JoyStick.cc	(revision 9558)
@@ -34,6 +34,6 @@
 
 #include "util/StringUtils.h"
-#include "core/ConfigFileManager.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigFileManager.h"
+#include "core/config/ConfigValueIncludes.h"
 #include "core/CoreIncludes.h"
 #include "util/Convert.h"
Index: code/branches/core6/src/libraries/core/input/KeyBinder.cc
===================================================================
--- code/branches/core6/src/libraries/core/input/KeyBinder.cc	(revision 9557)
+++ code/branches/core6/src/libraries/core/input/KeyBinder.cc	(revision 9558)
@@ -34,7 +34,7 @@
 #include "util/Output.h"
 #include "util/Exception.h"
-#include "core/ConfigValueIncludes.h"
 #include "core/CoreIncludes.h"
-#include "core/ConfigFileManager.h"
+#include "core/config/ConfigValueIncludes.h"
+#include "core/config/ConfigFileManager.h"
 #include "core/PathConfig.h"
 #include "InputCommands.h"
Index: code/branches/core6/src/libraries/core/input/KeyBinderManager.cc
===================================================================
--- code/branches/core6/src/libraries/core/input/KeyBinderManager.cc	(revision 9557)
+++ code/branches/core6/src/libraries/core/input/KeyBinderManager.cc	(revision 9558)
@@ -32,5 +32,5 @@
 #include "util/Exception.h"
 #include "util/ScopedSingletonManager.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
 #include "core/CoreIncludes.h"
 #include "core/LuaState.h"
Index: code/branches/core6/src/libraries/network/TrafficControl.cc
===================================================================
--- code/branches/core6/src/libraries/network/TrafficControl.cc	(revision 9557)
+++ code/branches/core6/src/libraries/network/TrafficControl.cc	(revision 9558)
@@ -33,5 +33,5 @@
 
 #include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
 #include "synchronisable/Synchronisable.h"
 
Index: code/branches/core6/src/libraries/network/WANDiscoverable.cc
===================================================================
--- code/branches/core6/src/libraries/network/WANDiscoverable.cc	(revision 9557)
+++ code/branches/core6/src/libraries/network/WANDiscoverable.cc	(revision 9558)
@@ -33,5 +33,5 @@
 
 #include "MasterServerProtocol.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
 #include "core/CoreIncludes.h"
 
Index: code/branches/core6/src/libraries/network/WANDiscovery.h
===================================================================
--- code/branches/core6/src/libraries/network/WANDiscovery.h	(revision 9557)
+++ code/branches/core6/src/libraries/network/WANDiscovery.h	(revision 9558)
@@ -31,8 +31,8 @@
 #include "NetworkPrereqs.h"
 #include "packet/ServerInformation.h"
-#include "core/ConfigFileManager.h"
+#include "core/CoreIncludes.h"
 #include "core/OrxonoxClass.h"
-#include "core/ConfigValueIncludes.h"
-#include "core/CoreIncludes.h"
+#include "core/config/ConfigFileManager.h"
+#include "core/config/ConfigValueIncludes.h"
 #include "MasterServerComm.h"
 #include "MasterServerProtocol.h"
Index: code/branches/core6/src/libraries/tools/ParticleInterface.cc
===================================================================
--- code/branches/core6/src/libraries/tools/ParticleInterface.cc	(revision 9557)
+++ code/branches/core6/src/libraries/tools/ParticleInterface.cc	(revision 9558)
@@ -43,5 +43,5 @@
 #include "util/Math.h"
 #include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
 #include "core/GameMode.h"
 
