Index: /code/branches/FICN/src/orxonox/core/ConfigValueContainer.cc
===================================================================
--- /code/branches/FICN/src/orxonox/core/ConfigValueContainer.cc	(revision 497)
+++ /code/branches/FICN/src/orxonox/core/ConfigValueContainer.cc	(revision 497)
@@ -0,0 +1,651 @@
+#include <fstream>
+#include <string>
+#include "ConfigValueContainer.h"
+
+//#define CONFIGFILEPATH "O:\\oh\\bin\\orxonox.ini"
+#define CONFIGFILEPATH "orxonox.ini"
+
+namespace orxonox
+{
+    std::list<std::string>* ConfigValueContainer::configFileLines_s = 0; // Set the static member variable configFileLines_s to zero
+    bool ConfigValueContainer::readConfigFile_s = false;                 // Set the static member variable readConfigFile_s to false
+
+    /**
+        @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets this->value_.value_int_.
+        @param classname The name of the class the variable belongs to
+        @param varname The name of the variable
+        @param defvalue The default-value
+    */
+    ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, int defvalue)
+    {
+        // Try to convert the default-value from int to string
+        std::ostringstream ostream;
+        if (ostream << defvalue)
+            this->defvalue_ = ostream.str();
+        else
+            this->defvalue_ = "0";
+
+        // Set the default values, then get the value-string
+        this->setDefaultValues(classname, varname);
+        std::string valueString = this->getValueString();
+
+        // Try to convert the value-string to int
+        std::istringstream istream(valueString);
+        if (!(istream >> this->value_.value_int_))
+        {
+            // The conversion failed - use the default value and restore the entry in the config-file
+            this->value_.value_int_ = defvalue;
+            (*this->configFileLine_) = this->varname_ + "=" + this->defvalue_;
+            ConfigValueContainer::writeConfigFile(CONFIGFILEPATH);
+        }
+    }
+
+    /**
+        @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets this->value_.value_double_.
+        @param classname The name of the class the variable belongs to
+        @param varname The name of the variable
+        @param defvalue The default-value
+    */
+    ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, double defvalue)
+    {
+        // Try to convert the default-value from double to string
+        std::ostringstream ostream;
+        if (ostream << defvalue)
+            this->defvalue_ = ostream.str();
+        else
+            this->defvalue_ = "0.000000";
+
+        // Set the default values, then get the value-string
+        this->setDefaultValues(classname, varname);
+        std::string valueString = this->getValueString();
+
+        // Try to convert the value-string to double
+        std::istringstream istream(valueString);
+        if (!(istream >> this->value_.value_double_))
+        {
+            // The conversion failed - use the default value and restore the entry in the config-file
+            this->value_.value_double_ = defvalue;
+            (*this->configFileLine_) = this->varname_ + "=" + this->defvalue_;
+            ConfigValueContainer::writeConfigFile(CONFIGFILEPATH);
+        }
+    }
+
+    /**
+        @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets this->value_.value_bool_.
+        @param classname The name of the class the variable belongs to
+        @param varname The name of the variable
+        @param defvalue The default-value
+    */
+    ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, bool defvalue)
+    {
+        // Convert the default-value from bool to string
+        if (defvalue)
+            this->defvalue_ = "true";
+        else
+            this->defvalue_ = "false";
+
+        // Set the default values, then get the value-string
+        this->setDefaultValues(classname, varname);
+        std::string valueString = this->getValueString();
+
+        // Try to parse the value-string - is it a word?
+        if (valueString.find("true") < valueString.size() || valueString.find("yes") < valueString.size())
+            this->value_.value_bool_ = true;
+        else if (valueString.find("false") < valueString.size() || valueString.find("no") < valueString.size())
+            this->value_.value_bool_ = false;
+        else
+        {
+            // Its not a known word - is it a number?
+            std::istringstream istream(valueString);
+            if (!(istream >> this->value_.value_bool_))
+            {
+                // The conversion failed - use the default value and restore the entry in the config-file
+                this->value_.value_bool_ = defvalue;
+                (*this->configFileLine_) = this->varname_ + "=" + this->defvalue_;
+                ConfigValueContainer::writeConfigFile(CONFIGFILEPATH);
+            }
+        }
+    }
+
+    /**
+        @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets this->value_string_.
+        @param classname The name of the class the variable belongs to
+        @param varname The name of the variable
+        @param defvalue The default-value
+    */
+    ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, const char* defvalue)
+    {
+        // Convert the string to a "config-file-string" with quotes
+        this->defvalue_ = "\"" + std::string(defvalue) + "\"";
+
+        // Set the default-values, then get the value-string
+        this->setDefaultValues(classname, varname);
+        std::string valueString = this->getValueString(false);
+
+        // Strip the quotes
+        unsigned int pos1 = valueString.find("\"") + 1;
+        unsigned int pos2 = valueString.find("\"", pos1);
+
+        // Check if the entry was correctly quoted
+        if (pos1 < valueString.length() && pos2 < valueString.length() && !(valueString.find("\"", pos2 + 1) < valueString.length()))
+        {
+            // It was - get the string between the quotes
+            valueString = valueString.substr(pos1, pos2 - pos1);
+            this->value_string_ = valueString;
+        }
+        else
+        {
+            // It wasn't - use the default-value and restore the entry in the config-file.
+            this->value_string_ = defvalue;
+            (*this->configFileLine_) = this->varname_ + "=" + this->defvalue_;
+            ConfigValueContainer::writeConfigFile(CONFIGFILEPATH);
+        }
+    }
+
+    /**
+        @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets this->value_vector2_.
+        @param classname The name of the class the variable belongs to
+        @param varname The name of the variable
+        @param defvalue The default-value
+    */
+    ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, Ogre::Vector2 defvalue)
+    {
+        // Try to convert the default-value from Vector2 to string
+        std::ostringstream ostream;
+        if (ostream << "(" << defvalue.x << "," << defvalue.y << ")")
+            this->defvalue_ = ostream.str();
+        else
+            this->defvalue_ = "(0,0)";
+
+        // Set the default values, then get the value-string
+        this->setDefaultValues(classname, varname);
+        std::string valueString = this->getValueString();
+
+        // Strip the value-string
+        bool bEntryIsCorrupt = false;
+        valueString = this->getStrippedLine(valueString);
+        unsigned int pos1, pos2, pos3;
+        pos1 = valueString.find("(");
+        if (pos1 == 0)
+            valueString.erase(pos1, 1);
+        else
+            bEntryIsCorrupt = true;
+
+        pos2 = valueString.find(")");
+        if (pos2 == valueString.length() - 1)
+            valueString.erase(pos2, 1);
+        else
+            bEntryIsCorrupt = true;
+
+        int count = 0;
+        while ((pos3 = valueString.find(",")) < valueString.length())
+        {
+            count++;
+            valueString.replace(pos3, 1, " ");
+            if (pos3 < pos1)
+                bEntryIsCorrupt = true;
+        }
+
+        if (count != 1)
+            bEntryIsCorrupt = true;
+
+        // Try to convert the stripped value-string to Vector2
+        if (!bEntryIsCorrupt)
+        {
+            std::istringstream istream(valueString);
+            if (!(istream >> this->value_vector2_.x))
+            {
+                // The conversion failed - use the default value and restore the entry in the config-file
+                this->value_vector2_.x = defvalue.x;
+                (*this->configFileLine_) = this->varname_ + "=" + this->defvalue_;
+                ConfigValueContainer::writeConfigFile(CONFIGFILEPATH);
+            }
+            if (!(istream >> this->value_vector2_.y))
+            {
+                // The conversion failed - use the default value and restore the entry in the config-file
+                this->value_vector2_.y = defvalue.y;
+                (*this->configFileLine_) = this->varname_ + "=" + this->defvalue_;
+                ConfigValueContainer::writeConfigFile(CONFIGFILEPATH);
+            }
+        }
+        else
+        {
+            // The conversion failed - use the default value and restore the entry in the config-file
+            this->value_vector2_ = defvalue;
+            (*this->configFileLine_) = this->varname_ + "=" + this->defvalue_;
+            ConfigValueContainer::writeConfigFile(CONFIGFILEPATH);
+        }
+    }
+
+    /**
+        @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets this->value_vector3_.
+        @param classname The name of the class the variable belongs to
+        @param varname The name of the variable
+        @param defvalue The default-value
+    */
+    ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, Ogre::Vector3 defvalue)
+    {
+        // Try to convert the default-value from Vector3 to string
+        std::ostringstream ostream;
+        if (ostream << "(" << defvalue.x << "," << defvalue.y << "," << defvalue.z << ")")
+            this->defvalue_ = ostream.str();
+        else
+            this->defvalue_ = "(0,0,0)";
+
+        // Set the default values, then get the value-string
+        this->setDefaultValues(classname, varname);
+        std::string valueString = this->getValueString();
+
+        // Strip the value-string
+        bool bEntryIsCorrupt = false;
+        valueString = this->getStrippedLine(valueString);
+        unsigned int pos1, pos2, pos3;
+        pos1 = valueString.find("(");
+        if (pos1 == 0)
+            valueString.erase(pos1, 1);
+        else
+            bEntryIsCorrupt = true;
+
+        pos2 = valueString.find(")");
+        if (pos2 == valueString.length() - 1)
+            valueString.erase(pos2, 1);
+        else
+            bEntryIsCorrupt = true;
+
+        int count = 0;
+        while ((pos3 = valueString.find(",")) < valueString.length())
+        {
+            count++;
+            valueString.replace(pos3, 1, " ");
+            if (pos3 < pos1)
+                bEntryIsCorrupt = true;
+        }
+
+        if (count != 2)
+            bEntryIsCorrupt = true;
+
+        // Try to convert the stripped value-string to Vector3
+        if (!bEntryIsCorrupt)
+        {
+            std::istringstream istream(valueString);
+            if (!(istream >> this->value_vector3_.x))
+            {
+                // The conversion failed - use the default value and restore the entry in the config-file
+                this->value_vector3_.x = defvalue.x;
+                (*this->configFileLine_) = this->varname_ + "=" + this->defvalue_;
+                ConfigValueContainer::writeConfigFile(CONFIGFILEPATH);
+            }
+            if (!(istream >> this->value_vector3_.y))
+            {
+                // The conversion failed - use the default value and restore the entry in the config-file
+                this->value_vector3_.y = defvalue.y;
+                (*this->configFileLine_) = this->varname_ + "=" + this->defvalue_;
+                ConfigValueContainer::writeConfigFile(CONFIGFILEPATH);
+            }
+            if (!(istream >> this->value_vector3_.z))
+            {
+                // The conversion failed - use the default value and restore the entry in the config-file
+                this->value_vector3_.z = defvalue.z;
+                (*this->configFileLine_) = this->varname_ + "=" + this->defvalue_;
+                ConfigValueContainer::writeConfigFile(CONFIGFILEPATH);
+            }
+        }
+        else
+        {
+            // The conversion failed - use the default value and restore the entry in the config-file
+            this->value_vector3_ = defvalue;
+            (*this->configFileLine_) = this->varname_ + "=" + this->defvalue_;
+            ConfigValueContainer::writeConfigFile(CONFIGFILEPATH);
+        }
+    }
+
+    /**
+        @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets this->value_colourvalue_.
+        @param classname The name of the class the variable belongs to
+        @param varname The name of the variable
+        @param defvalue The default-value
+    */
+    ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, Ogre::ColourValue defvalue)
+    {
+        // Try to convert the default-value from ColourValue to string
+        std::ostringstream ostream;
+        if (ostream << "(" << defvalue.r << "," << defvalue.g << "," << defvalue.b << "," << defvalue.a << ")")
+            this->defvalue_ = ostream.str();
+        else
+            this->defvalue_ = "(0,0,0,0)";
+
+        // Set the default values, then get the value-string
+        this->setDefaultValues(classname, varname);
+        std::string valueString = this->getValueString();
+
+        // Strip the value-string
+        bool bEntryIsCorrupt = false;
+        valueString = this->getStrippedLine(valueString);
+        unsigned int pos1, pos2, pos3;
+        pos1 = valueString.find("(");
+        if (pos1 == 0)
+            valueString.erase(pos1, 1);
+        else
+            bEntryIsCorrupt = true;
+
+        pos2 = valueString.find(")");
+        if (pos2 == valueString.length() - 1)
+            valueString.erase(pos2, 1);
+        else
+            bEntryIsCorrupt = true;
+
+        int count = 0;
+        while ((pos3 = valueString.find(",")) < valueString.length())
+        {
+            count++;
+            valueString.replace(pos3, 1, " ");
+            if (pos3 < pos1)
+                bEntryIsCorrupt = true;
+        }
+
+        if (count != 3)
+            bEntryIsCorrupt = true;
+
+        // Try to convert the stripped value-string to Vector3
+        if (!bEntryIsCorrupt)
+        {
+            std::istringstream istream(valueString);
+            if (!(istream >> this->value_colourvalue_.r))
+            {
+                // The conversion failed - use the default value and restore the entry in the config-file
+                this->value_colourvalue_.r = defvalue.r;
+                (*this->configFileLine_) = this->varname_ + "=" + this->defvalue_;
+                ConfigValueContainer::writeConfigFile(CONFIGFILEPATH);
+            }
+            if (!(istream >> this->value_colourvalue_.g))
+            {
+                // The conversion failed - use the default value and restore the entry in the config-file
+                this->value_colourvalue_.g = defvalue.g;
+                (*this->configFileLine_) = this->varname_ + "=" + this->defvalue_;
+                ConfigValueContainer::writeConfigFile(CONFIGFILEPATH);
+            }
+            if (!(istream >> this->value_colourvalue_.b))
+            {
+                // The conversion failed - use the default value and restore the entry in the config-file
+                this->value_colourvalue_.b = defvalue.b;
+                (*this->configFileLine_) = this->varname_ + "=" + this->defvalue_;
+                ConfigValueContainer::writeConfigFile(CONFIGFILEPATH);
+            }
+            if (!(istream >> this->value_colourvalue_.a))
+            {
+                // The conversion failed - use the default value and restore the entry in the config-file
+                this->value_colourvalue_.a = defvalue.a;
+                (*this->configFileLine_) = this->varname_ + "=" + this->defvalue_;
+                ConfigValueContainer::writeConfigFile(CONFIGFILEPATH);
+            }
+        }
+        else
+        {
+            // The conversion failed - use the default value and restore the entry in the config-file
+            this->value_colourvalue_ = defvalue;
+            (*this->configFileLine_) = this->varname_ + "=" + this->defvalue_;
+            ConfigValueContainer::writeConfigFile(CONFIGFILEPATH);
+        }
+    }
+
+    /**
+        @brief Sets the default values of the container and searches the coresponding entry in the config-file.
+        @param classname The name of the class the variable belongs to
+        @param varname The name of the variable
+    */
+    void ConfigValueContainer::setDefaultValues(const std::string& classname, const std::string& varname)
+    {
+        // Set the class and variable names
+        this->classname_ = classname;
+        this->varname_ = varname;
+
+        // Search the entry in the config-file
+        this->searchConfigFileLine();
+
+        // Set the values of all types to zero
+        this->value_.value_int_ = 0;
+        this->value_.value_double_ = 0.000000;
+        this->value_.value_bool_ = false;
+        this->value_string_ = "";
+        this->value_vector2_ = Ogre::Vector2(0, 0);
+        this->value_vector3_ = Ogre::Vector3(0, 0, 0);
+        this->value_colourvalue_ = Ogre::ColourValue(0, 0, 0, 0);
+    }
+
+    /**
+        @brief Searches the corresponding entry in the config-file and creates it, if there is no entry.
+    */
+    void ConfigValueContainer::searchConfigFileLine()
+    {
+        // Read the file if needed
+        if (!ConfigValueContainer::readConfigFile_s)
+            ConfigValueContainer::readConfigFile(CONFIGFILEPATH);
+
+        // The string of the section we're searching
+        std::string section = "";
+        section.append("[");
+        section.append(this->classname_);
+        section.append("]");
+
+        // Iterate through all config-file-lines
+        bool success = false;
+        std::list<std::string>::iterator it1;
+        for(it1 = ConfigValueContainer::configFileLines_s->begin(); it1 != ConfigValueContainer::configFileLines_s->end(); ++it1)
+        {
+            // Don't try to parse comments
+            if (this->isComment(*it1))
+                continue;
+
+            if ((*it1).find(section) < (*it1).length())
+            {
+                // We found the right section
+                bool bLineIsEmpty = false;
+                std::list<std::string>::iterator positionToPutNewLineAt;
+
+                // Iterate through all lines in the section
+                std::list<std::string>::iterator it2;
+                for(it2 = ++it1; it2 != ConfigValueContainer::configFileLines_s->end(); ++it2)
+                {
+                    // Don't try to parse comments
+                    if (this->isComment(*it2))
+                        continue;
+
+                    // This if-else block is used to write a new line right after the last line of the
+                    // section but in front of the following empty lines before the next section.
+                    // (So this helps to keep a nice formatting with empty-lines between sections in the config-file)
+                    if (this->isEmpty(*it2))
+                    {
+                        if (!bLineIsEmpty)
+                        {
+                            bLineIsEmpty = true;
+                            positionToPutNewLineAt = it2;
+                        }
+                    }
+                    else
+                    {
+                        if (!bLineIsEmpty)
+                            positionToPutNewLineAt = it2;
+
+                        bLineIsEmpty = false;
+                    }
+
+                    // Look out for the beginning of the next section
+                    unsigned int open = (*it2).find("[");
+                    unsigned int close = (*it2).find("]");
+                    if ((open < (*it2).length()) && (close < (*it2).length()) && (open < close))
+                    {
+                        // The next section startet, so our line isn't yet in the file - now we add it and safe the file
+                        this->configFileLine_ = this->configFileLines_s->insert(positionToPutNewLineAt, this->varname_ + "=" + this->defvalue_);
+                        ConfigValueContainer::writeConfigFile(CONFIGFILEPATH);
+                        success = true;
+                        break;
+                    }
+
+                    // Look out for the variable-name
+                    if ((*it2).find(this->varname_) < (*it2).length())
+                    {
+                        // We found the right line - safe it and return
+                        this->configFileLine_ = it2;
+                        success = true;
+                        break;
+                    }
+                }
+
+                // Check if we succeeded
+                if (!success)
+                {
+                    // Looks like we found the right section, but the file ended without containing our variable - so we add it and safe the file
+                    this->configFileLine_ = this->configFileLines_s->insert(positionToPutNewLineAt, this->varname_ + "=" + this->defvalue_);
+                    ConfigValueContainer::writeConfigFile(CONFIGFILEPATH);
+                    success = true;
+                }
+                break;
+            }
+        }
+
+        // Check if we succeeded
+        if (!success)
+        {
+            // We obviously didn't found the right section, so we'll create it
+            this->configFileLines_s->push_back("[" + this->classname_ + "]");           // Create the section
+            this->configFileLines_s->push_back(this->varname_ + "=" + this->defvalue_); // Create the line
+            this->configFileLine_ = --this->configFileLines_s->end();                   // Set the pointer to the last element
+            success = true;
+            this->configFileLines_s->push_back("");                                     // Add an empty line - this is needed for the algorithm in the searchConfigFileLine-function
+            ConfigValueContainer::writeConfigFile(CONFIGFILEPATH);                      // Save the changed config-file
+        }
+    }
+
+    /**
+        @brief Determines if a line in the config-file is a comment.
+        @param line The line to check
+        @return True = it's a comment
+    */
+    bool ConfigValueContainer::isComment(const std::string& line)
+    {
+        // Strip the line, whitespaces are disturbing
+        std::string teststring = getStrippedLine(line);
+
+        // There are four possible comment-symbols:
+        //  1) #comment in script-language style
+        //  2) %comment in matlab style
+        //  3) ;comment in unreal tournament config-file style
+        //  4) //comment in code style
+        if (teststring[0] == '#' || teststring[0] == '%' || teststring[0] == ';' || (teststring[0] == '/' && teststring[0] == '/'))
+            return true;
+
+        return false;
+    }
+
+    /**
+        @brief Determines if a line in the config-file is empty (contains only whitespaces).
+        @param line The line to check
+        @return True = it's empty
+    */
+    bool ConfigValueContainer::isEmpty(const std::string& line)
+    {
+        return getStrippedLine(line) == "";
+    }
+
+    /**
+        @brief Removes all whitespaces from a line.
+        @param line The line to strip
+        @return The stripped line
+    */
+    std::string ConfigValueContainer::getStrippedLine(const std::string& line)
+    {
+        std::string output = line;
+        unsigned int pos;
+        while ((pos = output.find(" ")) < output.length())
+            output.erase(pos, 1);
+        while ((pos = output.find("\t")) < output.length())
+            output.erase(pos, 1);
+
+        return output;
+    }
+
+    /**
+        @brief Returns the part in the corresponding config-file-entry of the container that defines the value.
+        @param bStripped True = strip the value-string
+        @return The value-string
+    */
+    std::string ConfigValueContainer::getValueString(bool bStripped)
+    {
+        std::string output;
+        if (bStripped)
+            output = this->getStrippedLine(*this->configFileLine_);
+        else
+            output = *this->configFileLine_;
+
+        return output.substr(output.find("=") + 1);
+    }
+
+    /**
+        @brief Reads the config-file and stores the lines in a list.
+        @param filename The name of the config-file
+    */
+    void ConfigValueContainer::readConfigFile(const std::string& filename)
+    {
+        ConfigValueContainer::readConfigFile_s = true;
+
+        // Create the list if needed
+        if (!ConfigValueContainer::configFileLines_s)
+            ConfigValueContainer::configFileLines_s = new std::list<std::string>;
+
+        // This creates the file if it's not existing
+        std::ofstream createFile;
+        createFile.open(filename.c_str(), std::fstream::app);
+        createFile.close();
+
+        // Open the file
+        std::ifstream file;
+        file.open(filename.c_str(), std::fstream::in);
+
+        char line[1024];
+
+        // Iterate through the file and add the lines into the list
+        while (file.good() && !file.eof())
+        {
+            file.getline(line, 1024);
+            ConfigValueContainer::configFileLines_s->push_back(line);
+//            std::cout << "### ->" << line << "<- : empty: " << isEmpty(line) << " comment: " << isComment(line) << std::endl;
+        }
+
+        // The last line is useless
+        ConfigValueContainer::configFileLines_s->pop_back();
+
+        // Add an empty line to the end of the file if needed
+        // this is needed for the algorithm in the searchConfigFileLine-function
+        if ((ConfigValueContainer::configFileLines_s->size() > 0) && !isEmpty(*ConfigValueContainer::configFileLines_s->rbegin()))
+        {
+//            std::cout << "### newline added" << std::endl;
+            ConfigValueContainer::configFileLines_s->push_back("");
+        }
+
+        file.close();
+    }
+
+    /**
+        @param Writes the content of the list, containing all lines of the config-file, into the config-file.
+        @param filename The name of the config-file
+    */
+    void ConfigValueContainer::writeConfigFile(const std::string& filename)
+    {
+        // Make sure we stored the config-file in the list
+        if (!ConfigValueContainer::readConfigFile_s)
+            ConfigValueContainer::readConfigFile(filename);
+
+        // Open the file
+        std::ofstream file;
+        file.open(filename.c_str(), std::fstream::out);
+
+        // Iterate through the list an write the lines into the file
+        std::list<std::string>::iterator it;
+        for(it = ConfigValueContainer::configFileLines_s->begin(); it != ConfigValueContainer::configFileLines_s->end(); ++it)
+        {
+            file << (*it) << std::endl;
+        }
+
+        file.close();
+    }
+}
Index: /code/branches/FICN/src/orxonox/core/ConfigValueContainer.h
===================================================================
--- /code/branches/FICN/src/orxonox/core/ConfigValueContainer.h	(revision 497)
+++ /code/branches/FICN/src/orxonox/core/ConfigValueContainer.h	(revision 497)
@@ -0,0 +1,102 @@
+/*!
+    @file ConfigValueContainer.h
+    @brief Definition of the ConfigValueContainer class.
+
+    The ConfigValueContainer class contains all needed informations 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 <string>
+#include <list>
+
+#include "OgreVector2.h"
+#include "OgreVector3.h"
+#include "OgreColourValue.h"
+
+namespace orxonox
+{
+    //! The ConfigValuecontainer contains all needed informations about a configurable variable.
+    /**
+        The ConfigValueContainer class contains all needed informations 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 ConfigValueContainer
+    {
+        public:
+            ConfigValueContainer(const std::string& classname, const std::string& varname, int defvalue);
+            ConfigValueContainer(const std::string& classname, const std::string& varname, double defvalue);
+            ConfigValueContainer(const std::string& classname, const std::string& varname, bool defvalue);
+            ConfigValueContainer(const std::string& classname, const std::string& varname, const char* defvalue);
+            ConfigValueContainer(const std::string& classname, const std::string& varname, Ogre::Vector2 defvalue);
+            ConfigValueContainer(const std::string& classname, const std::string& varname, Ogre::Vector3 defvalue);
+            ConfigValueContainer(const std::string& classname, const std::string& varname, Ogre::ColourValue defvalue);
+
+            void setDefaultValues(const std::string& classname, const std::string& varname);
+            void searchConfigFileLine();
+            std::string getValueString(bool bStripped = true);
+
+            static std::string getStrippedLine(const std::string& line);
+            static bool isEmpty(const std::string& line);
+            static bool isComment(const std::string& line);
+            static void readConfigFile(const std::string& filename);
+            static void writeConfigFile(const std::string& filename);
+
+            /** @returns the value of the type int. @param value This is only needed to determine the right type. */
+            inline int getValue(int value)                                      { return this->value_.value_int_; }
+            /** @returns the value of the type double. @param value This is only needed to determine the right type. */
+            inline double getValue(double value)                                { return this->value_.value_double_; }
+            /** @returns the value of the type bool. @param value This is only needed to determine the right type. */
+            inline bool getValue(bool value)                                    { return this->value_.value_bool_; }
+            /** @returns the value of the type std::string. @param value This is only needed to determine the right type. */
+            inline std::string getValue(const std::string& value)               { return this->value_string_; }
+            /** @returns the value of the type Vector2. @param value This is only needed to determine the right type. */
+            inline Ogre::Vector2 getValue(const Ogre::Vector2& value)           { return this->value_vector2_; }
+            /** @returns the value of the type Vector3. @param value This is only needed to determine the right type. */
+            inline Ogre::Vector3 getValue(const Ogre::Vector3& value)           { return this->value_vector3_; }
+            /** @returns the value of the type Colour£Value. @param value This is only needed to determine the right type. */
+            inline Ogre::ColourValue getValue(const Ogre::ColourValue& value)   { return this->value_colourvalue_; }
+
+        private:
+            std::string         classname_;                     //!< The name of the class the variable belongs to
+            std::string         varname_;                       //!< The name of the variable
+            std::string         defvalue_;                      //!< The string of the default-variable
+
+            union MultiType
+            {
+                int                 value_int_;                 //!< The value, if the variable is of the type int
+                double              value_double_;              //!< The value, if the variable is of the type double
+                bool                value_bool_;                //!< The value, if the variable is of the type bool
+            } value_;
+
+            std::string         value_string_;                  //!< The value, if the variable is of the type string
+            Ogre::Vector2       value_vector2_;                 //!< The value, if the variable is of the type Vector2
+            Ogre::Vector3       value_vector3_;                 //!< The value, if the variable is of the type Vector3
+            Ogre::ColourValue   value_colourvalue_;             //!< The value, if the variable is of the type ColourValue
+
+            std::list<std::string>::iterator configFileLine_;   //!< An iterator, pointing to the entry of the variable in the config-file
+            static std::list<std::string>* configFileLines_s;   //!< A list, containing all entrys in the config-file
+            static bool readConfigFile_s;                       //!< True if the config-file is read and stored in the list
+    };
+}
+
+#endif
Index: /code/branches/FICN/src/orxonox/core/CoreIncludes.h
===================================================================
--- /code/branches/FICN/src/orxonox/core/CoreIncludes.h	(revision 497)
+++ /code/branches/FICN/src/orxonox/core/CoreIncludes.h	(revision 497)
@@ -0,0 +1,111 @@
+/**
+    @file CoreIncludes.h
+    @brief Definition of macros and typedefs.
+
+    Every class needs the RegisterObject(class) macro in its constructor. If the class is an interface
+    or the BaseObject itself, it needs the macro RegisterRootObject(class) instead.
+
+    To allow the object being created through the factory, use the CreateFactory(class) macro outside
+    the of the class implementation, so it gets executed before main().
+*/
+
+// All needed header-files
+#include "Identifier.h"
+#include "Factory.h"
+#include "ClassFactory.h"
+#include "Iterator.h"
+#include "OrxonoxClass.h"
+#include "ConfigValueContainer.h"
+#include "Debug.h"
+
+#include "OgreVector2.h"
+#include "OgreVector3.h"
+#include "OgreColourValue.h"
+#include "OgreQuaternion.h"
+#include "OgreMatrix3.h"
+
+
+// Some typedefs
+namespace orxonox
+{
+    typedef Ogre::Vector2 Vector2;
+    typedef Ogre::Vector3 Vector3;
+    typedef Ogre::ColourValue ColourValue;
+    typedef Ogre::Radian Radian;
+    typedef Ogre::Degree Degree;
+    typedef Ogre::Real Real;
+    typedef Ogre::Quaternion Quaternion;
+    typedef Ogre::Matrix3 Matrix3;
+}
+
+
+/**
+    @brief Intern macro, containing the common parts of RegisterObject and RegisterRootObject.
+    @param ClassName The name of the class
+    @param bRootClass True if the class is directly derived from OrxonoxClass
+*/
+#define InternRegisterObject(ClassName, bRootClass) \
+    this->setIdentifier(orxonox::ClassIdentifier<ClassName>::registerClass(this->getParents(), #ClassName, bRootClass)); \
+    if (orxonox::Identifier::isCreatingHierarchy() && this->getParents()) \
+        this->getParents()->add(this->getIdentifier()); \
+    orxonox::ClassIdentifier<ClassName>::addObject(this)
+
+/**
+    @brief Intern macro, containing the specific part of RegisterRootObject.
+    @param ClassName The name of the class
+*/
+#define InternRegisterRootObject(ClassName) \
+    if (orxonox::Identifier::isCreatingHierarchy() && !this->getParents()) \
+        this->setParents(new IdentifierList()); \
+    InternRegisterObject(ClassName, true)
+
+/**
+    @brief RegisterObject - with and without debug output.
+    @param ClassName The name of the class
+*/
+#define RegisterObject(ClassName) \
+    COUT(4) << "*** Register Object: " << #ClassName << "\n"; \
+    InternRegisterObject(ClassName, false)
+
+/**
+    @brief RegisterRootObject - with and without debug output.
+    @param ClassName The name of the class
+*/
+#define RegisterRootObject(ClassName) \
+    COUT(4) << "*** Register Root-Object: " << #ClassName << "\n"; \
+    InternRegisterRootObject(ClassName)
+
+/**
+    @brief Returns the Identifier of the given class.
+    @param ClassName The name of the class
+*/
+#define Class(ClassName) \
+    ClassIdentifier<ClassName>::getIdentifier()
+
+/**
+    @brief Creates the entry in the Factory.
+    @param ClassName The name of the class
+*/
+#define CreateFactory(ClassName) \
+    bool bCreated##ClassName##Factory = orxonox::ClassFactory<ClassName>::create(#ClassName)
+
+/**
+    @brief Returns the Identifier with either a given name or a given network ID through the factory.
+    @param StringOrInt The name or the network ID of the class
+*/
+#define ID(StringOrInt) \
+    orxonox::Factory::getIdentifier(StringOrInt)
+
+/**
+    @brief Assigns the value, defined in the config-file, to the variable (or the default-value, if there is no entry in the file).
+    @param varname The name of the variable
+    @param defvalue The default-value of the variable
+*/
+#define SetConfigValue(varname, defvalue) \
+    orxonox::ConfigValueContainer* container##varname = this->getIdentifier()->getConfigValueContainer(#varname); \
+    if (!container##varname) \
+    { \
+        container##varname = new orxonox::ConfigValueContainer(this->getIdentifier()->getName(), #varname, defvalue); \
+        this->getIdentifier()->setConfigValueContainer(#varname, container##varname); \
+    } \
+    varname = container##varname->getValue(varname)
Index: de/branches/FICN/src/orxonox/core/IdentifierIncludes.h
===================================================================
--- /code/branches/FICN/src/orxonox/core/IdentifierIncludes.h	(revision 496)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/**
-    @file IDentifierIncludes.h
-    @brief Definition of macros for the class-hierarchy and the factory.
-
-    Every class needs the RegisterObject(class) macro in its constructor. If the class is an interface
-    or the BaseObject itself, it needs the macro RegisterRootObject(class) instead.
-
-    To allow the object being created through the factory, use the CreateFactory(class) macro outside
-    the of the class implementation, so it gets executed before main().
-*/
-
-// All needed header-files
-#include "Identifier.h"
-#include "Factory.h"
-#include "ClassFactory.h"
-#include "Iterator.h"
-#include "OrxonoxClass.h"
-
-
-// Intern macro, containing the common parts of RegisterObject and RegisterRootObject
-#define InternRegisterObject(ClassName, bRootClass) \
-    this->setIdentifier(ClassIdentifier<ClassName>::registerClass(this->getParents(), #ClassName, bRootClass)); \
-    if (Identifier::isCreatingHierarchy() && this->getParents()) \
-        this->getParents()->add(this->getIdentifier()); \
-    ClassIdentifier<ClassName>::addObject(this)
-
-// Intern macro, containing the specific part of RegisterRootObject
-#define InternRegisterRootObject(ClassName) \
-    if (Identifier::isCreatingHierarchy() && !this->getParents()) \
-        this->setParents(new IdentifierList()); \
-    InternRegisterObject(ClassName, true)
-
-// RegisterObject - with and without debug output
-#if HIERARCHY_VERBOSE
-#define RegisterObject(ClassName) \
-    std::cout << "*** Register Object: " << #ClassName << "\n"; \
-    InternRegisterObject(ClassName, false)
-#else
-#define RegisterObject(ClassName) \
-    InternRegisterObject(ClassName, false)
-#endif
-
-// RegisterRootObject - with and without debug output
-#if HIERARCHY_VERBOSE
-#define RegisterRootObject(ClassName) \
-    std::cout << "*** Register Root-Object: " << #ClassName << "\n"; \
-    InternRegisterRootObject(ClassName)
-#else
-#define RegisterRootObject(ClassName) \
-    InternRegisterRootObject(ClassName)
-#endif
-
-// Class(ClassName) returns the Identifier of the given class
-#define Class(ClassName) \
-    ClassIdentifier<ClassName>::getIdentifier()
-
-// Creates the entry in the Factory
-#define CreateFactory(ClassName) \
-    bool bCreated##ClassName##Factory = ClassFactory<ClassName>::create()
-
-// ID(StringOrInt) returns the Identifier with either a given name or a given NetworkID through the factory
-#define ID(StringOrInt) \
-    Factory::getIdentifier(StringOrInt)
Index: /code/branches/FICN/src/orxonox/core/SignalHandler.cc
===================================================================
--- /code/branches/FICN/src/orxonox/core/SignalHandler.cc	(revision 497)
+++ /code/branches/FICN/src/orxonox/core/SignalHandler.cc	(revision 497)
@@ -0,0 +1,296 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+### File Specific:
+   main-programmer: Christoph Renner
+   co-programmer: ...
+*/
+
+#include "SignalHandler.h"
+#include <assert.h>
+
+SignalHandler * SignalHandler::singletonRef = NULL;
+
+#ifndef __WIN32__
+
+#include <wait.h>
+
+SignalHandler::SignalHandler()
+{
+}
+
+/**
+ * register signal handlers for SIGSEGV and SIGABRT
+ * @param appName path to executable eg argv[0]
+ * @param fileName filename to append backtrace to
+ */
+void SignalHandler::doCatch( const std::string & appName, const std::string & fileName )
+{
+  this->appName = appName;
+  this->fileName = fileName;
+
+  // make sure doCatch is only called once without calling dontCatch
+  assert( sigRecList.size() == 0 );
+
+  catchSignal( SIGSEGV );
+  catchSignal( SIGABRT );
+  catchSignal( SIGILL );
+}
+
+/**
+ * restore previous signal handlers
+ */
+void SignalHandler::dontCatch()
+{
+  for ( SignalRecList::iterator it = sigRecList.begin(); it != sigRecList.end(); it++ )
+  {
+    signal( it->signal, it->handler );
+  }
+
+  sigRecList.clear();
+}
+
+/**
+ * catch signal sig
+ * @param sig signal to catch
+ */
+void SignalHandler::catchSignal( int sig )
+{
+  sig_t handler = signal( sig, SignalHandler::sigHandler );
+
+  assert( handler != SIG_ERR );
+
+  SignalRec rec;
+  rec.signal = sig;
+  rec.handler = handler;
+
+  sigRecList.push_front( rec );
+}
+
+/**
+ * sigHandler is called when receiving signals
+ * @param sig
+ */
+void SignalHandler::sigHandler( int sig )
+{
+  for ( SignalCallbackList::iterator it = SignalHandler::getInstance()->callbackList.begin(); it != SignalHandler::getInstance()->callbackList.end(); it++  )
+  {
+    (*(it->cb))( it->someData );
+  }
+
+  std::string sigName = "UNKNOWN";
+
+  switch ( sig )
+  {
+    case SIGSEGV:
+      sigName = "SIGSEGV";
+      break;
+    case SIGABRT:
+      sigName = "SIGABRT";
+      break;
+    case SIGILL:
+      sigName = "SIGILL";
+      break;
+  }
+
+  printf( "recieved signal %s\ntry to write backtrace to file orxonox.log\n", sigName.c_str() );
+
+  int sigPipe[2];
+  if ( pipe(sigPipe) == -1 )
+  {
+    perror("pipe failed!\n");
+    exit(EXIT_FAILURE);
+  }
+
+  int sigPid = fork();
+
+  if ( sigPid == -1 )
+  {
+    perror("fork failed!\n");
+    exit(EXIT_FAILURE);
+  }
+
+  // gdb will be attached to this process
+  if ( sigPid == 0 )
+  {
+    getInstance()->dontCatch();
+    // wait for message from parent when it has attached gdb
+    int someData;
+
+    read( sigPipe[0], &someData, sizeof(someData) );
+
+    if ( someData != 0x12345678 )
+    {
+      printf("something went wrong :(\n");
+    }
+
+    return;
+  }
+
+  int gdbIn[2];
+  int gdbOut[2];
+  int gdbErr[2];
+
+  if ( pipe(gdbIn) == -1 || pipe(gdbOut) == -1 || pipe(gdbErr) == -1 )
+  {
+    perror("pipe failed!\n");
+    kill( sigPid, SIGTERM );
+    waitpid( sigPid, NULL, 0 );
+    exit(EXIT_FAILURE);
+  }
+
+  int gdbPid = fork();
+  // this process will run gdb
+
+  if ( gdbPid == -1 )
+  {
+    perror("fork failed\n");
+    kill( sigPid, SIGTERM );
+    waitpid( sigPid, NULL, 0 );
+    exit(EXIT_FAILURE);
+  }
+
+  if ( gdbPid == 0 )
+  {
+    // start gdb
+
+    close(gdbIn[1]);
+    close(gdbOut[0]);
+    close(gdbErr[0]);
+
+    dup2( gdbIn[0], STDIN_FILENO );
+    dup2( gdbOut[1], STDOUT_FILENO );
+    dup2( gdbErr[1], STDERR_FILENO );
+
+    execlp( "sh", "sh", "-c", "gdb", (void*)NULL);
+  }
+
+  char cmd[256];
+  snprintf( cmd, 256, "file %s\nattach %d\nc\n", getInstance()->appName.c_str(), sigPid );
+  write( gdbIn[1], cmd, strlen(cmd) );
+
+  int charsFound = 0;
+  int promptFound = 0;
+  char byte;
+  while ( read( gdbOut[0], &byte, 1 ) == 1 )
+  {
+    if (
+      charsFound == 0 && byte == '(' ||
+      charsFound == 1 && byte == 'g' ||
+      charsFound == 2 && byte == 'd' ||
+      charsFound == 3 && byte == 'b' ||
+      charsFound == 4 && byte == ')' ||
+      charsFound == 5 && byte == ' '
+        )
+          charsFound++;
+    else
+      charsFound = 0;
+
+    if ( charsFound == 6 )
+    {
+      promptFound++;
+      charsFound = 0;
+    }
+
+    if ( promptFound == 3 )
+    {
+      break;
+    }
+  }
+
+  int someData = 0x12345678;
+  write( sigPipe[1], &someData, sizeof(someData) );
+
+  write( gdbIn[1], "bt\nk\nq\n", 7 );
+
+
+  charsFound = 0;
+  promptFound = 0;
+  std::string bt;
+  while ( read( gdbOut[0], &byte, 1 ) == 1 )
+  {
+    bt += std::string( &byte, 1 );
+
+    if (
+      charsFound == 0 && byte == '(' ||
+      charsFound == 1 && byte == 'g' ||
+      charsFound == 2 && byte == 'd' ||
+      charsFound == 3 && byte == 'b' ||
+      charsFound == 4 && byte == ')' ||
+      charsFound == 5 && byte == ' '
+        )
+          charsFound++;
+    else
+      charsFound = 0;
+
+    if ( charsFound == 6 )
+    {
+      promptFound++;
+      charsFound = 0;
+      bt += "\n";
+    }
+
+    if ( promptFound == 3 )
+    {
+      break;
+    }
+  }
+
+
+  waitpid( sigPid, NULL, 0 );
+  waitpid( gdbPid, NULL, 0 );
+
+  int wsRemoved = 0;
+
+  while ( wsRemoved < 2 && bt.length() > 0 )
+  {
+    if ( bt[1] == '\n' )
+      wsRemoved++;
+    bt.erase(0, 1);
+  }
+
+  if ( bt.length() > 0 )
+    bt.erase(0, 1);
+
+  time_t now = time(NULL);
+
+  std::string timeString = "\n\n\n\n"
+	                   "=======================================================\n"
+	                   "= time: " + std::string(ctime(&now)) +
+			   "=======================================================\n";
+  bt.insert(0, timeString);
+
+  FILE * f = fopen( getInstance()->fileName.c_str(), "a" );
+
+  if ( !f )
+  {
+    perror( ( std::string( "could not append to " ) + getInstance()->fileName ).c_str() );
+    exit(EXIT_FAILURE);
+  }
+
+  if ( fwrite( bt.c_str(), 1, bt.length(), f ) != bt.length() )
+  {
+    printf( ( std::string("could not write %d byte to ") + getInstance()->fileName ).c_str(), bt.length());
+    exit(EXIT_FAILURE);
+  }
+
+  exit(EXIT_FAILURE);
+}
+
+void SignalHandler::registerCallback( SignalCallback cb, void * someData )
+{
+  SignalCallbackRec rec;
+  rec.cb = cb;
+  rec.someData = someData;
+
+  callbackList.push_back(rec);
+}
+
+#endif /* __WIN32__ */
Index: /code/branches/FICN/src/orxonox/core/SignalHandler.h
===================================================================
--- /code/branches/FICN/src/orxonox/core/SignalHandler.h	(revision 497)
+++ /code/branches/FICN/src/orxonox/core/SignalHandler.h	(revision 497)
@@ -0,0 +1,74 @@
+/*!
+ * @file SignalHandler.h
+ */
+
+#ifndef _SignalHandler_H__
+#define _SignalHandler_H__
+
+#include <list>
+#include <string>
+
+typedef int (*SignalCallback)( void * someData );
+
+#ifndef __WIN32__
+#include <signal.h>
+
+struct SignalRec
+{
+  int signal;
+  sig_t handler;
+};
+
+struct SignalCallbackRec
+{
+  SignalCallback cb;
+  void * someData;
+};
+
+
+typedef std::list<SignalRec> SignalRecList;
+typedef std::list<SignalCallbackRec> SignalCallbackList;
+
+class SignalHandler
+{
+  private:
+    SignalHandler();
+  public:
+    inline static SignalHandler* getInstance() { if (!SignalHandler::singletonRef) SignalHandler::singletonRef = new SignalHandler(); return SignalHandler::singletonRef; }
+    ~SignalHandler(){ SignalHandler::singletonRef = NULL; }
+
+    void registerCallback( SignalCallback cb, void * someData );
+
+    void doCatch( const std::string & appName, const std::string & fileName );
+    void dontCatch();
+
+  private:
+    static void sigHandler( int sig );
+
+    void catchSignal( int sig );
+    SignalRecList sigRecList;
+
+    SignalCallbackList callbackList;
+
+    static SignalHandler * singletonRef;
+
+    std::string appName;
+    std::string fileName;
+};
+
+#else /* if defined __WIN32__ */
+class SignalHandler
+{
+ public:
+   inline static SignalHandler* getInstance() { if (!SignalHandler::singletonRef) SignalHandler::singletonRef = new SignalHandler(); return SignalHandler::singletonRef; };
+   void doCatch( const std::string & appName, const std::string & fileName ) {};
+  void dontCatch() {};
+  void registerCallback( SignalCallback cb, void * someData ) {};
+
+ private:
+    static SignalHandler * singletonRef;
+};
+#endif
+
+#endif /* _SignalHandler_H__ */
+
Index: /code/branches/FICN/src/orxonox/objects/WorldEntity.cc
===================================================================
--- /code/branches/FICN/src/orxonox/objects/WorldEntity.cc	(revision 497)
+++ /code/branches/FICN/src/orxonox/objects/WorldEntity.cc	(revision 497)
@@ -0,0 +1,53 @@
+#include <string>
+#include <sstream>
+
+#include "WorldEntity.h"
+#include "../core/CoreIncludes.h"
+
+namespace orxonox
+{
+    CreateFactory(WorldEntity);
+
+    Ogre::SceneManager* WorldEntity::sceneManager_s = 0;
+    unsigned int WorldEntity::worldEntityCounter_s = 0;
+    int WorldEntity::num_s = 0;
+
+    WorldEntity::WorldEntity()
+    {
+        RegisterObject(WorldEntity);
+
+        if (WorldEntity::sceneManager_s)
+            WorldEntity::sceneManager_s->setAmbientLight( ColourValue( 1, 1, 1 ) ); // remove this
+
+        if (WorldEntity::sceneManager_s)
+        {
+            std::ostringstream name;
+            name << (WorldEntity::worldEntityCounter_s++);
+            this->setName("WorldEntity" + name.str());
+            node_ = WorldEntity::sceneManager_s->getRootSceneNode()->createChildSceneNode(this->getName());
+        }
+
+        this->bStatic_ = true;
+        this->velocity_ = Vector3(0, 0, 0);
+        this->acceleration_ = Vector3(0, 0, 0);
+        this->rotationAxis_ = Vector3(0, 1, 0);
+        this->rotationRate_ = 0;
+        this->momentum_ = 0;
+    }
+
+    WorldEntity::~WorldEntity()
+    {
+    }
+
+    void WorldEntity::tick(float dt)
+    {
+        if (!this->bStatic_)
+        {
+            this->velocity_ += (dt * this->acceleration_);
+            this->translate(dt * this->velocity_);
+
+            this->rotationRate_ += (dt * this->momentum_);
+            this->rotate(this->rotationAxis_, dt * this->rotationRate_);
+        }
+    }
+}
Index: /code/branches/FICN/src/orxonox/objects/WorldEntity.h
===================================================================
--- /code/branches/FICN/src/orxonox/objects/WorldEntity.h	(revision 497)
+++ /code/branches/FICN/src/orxonox/objects/WorldEntity.h	(revision 497)
@@ -0,0 +1,114 @@
+#ifndef _WorldEntity_H__
+#define _WorldEntity_H__
+
+#include "BaseObject.h"
+#include "Tickable.h"
+#include "../core/CoreIncludes.h"
+#include "OgreSceneManager.h"
+#include "OgreSceneNode.h"
+
+namespace orxonox
+{
+    class WorldEntity : public BaseObject, public Tickable
+    {
+        public:
+            WorldEntity();
+            ~WorldEntity();
+
+            void tick(float dt);
+
+            inline Ogre::SceneNode* getNode()
+                { return this->node_; }
+
+            inline void setPosition(const Vector3& pos)
+                { this->node_->setPosition(pos); }
+            inline void setPosition(Real x, Real y, Real z)
+                { this->node_->setPosition(x, y, z); }
+            inline const Vector3& getPosition() const
+                { return this->node_->getPosition(); }
+
+            inline void translate(const Vector3 &d, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT)
+                { this->node_->translate(d, relativeTo); }
+            inline void translate(Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT)
+                { this->node_->translate(x, y, z, relativeTo); }
+            inline void translate(const Matrix3 &axes, const Vector3 &move, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT)
+                { this->node_->translate(axes, move, relativeTo); }
+            inline void translate(const Matrix3 &axes, Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT)
+                { this->node_->translate(axes, x, y, z, relativeTo); }
+
+            inline void yaw(const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL)
+                { this->node_->yaw(angle, relativeTo); }
+            inline void pitch(const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL)
+                { this->node_->pitch(angle, relativeTo); }
+            inline void roll(const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL)
+                { this->node_->roll(angle, relativeTo); }
+
+            inline void rotate(const Vector3 &axis, const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL)
+                { this->node_->rotate(axis, angle, relativeTo); }
+            inline void setDirection(Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z)
+                { this->node_->setDirection(x, y, z, relativeTo, localDirectionVector); }
+            inline void setDirection(const Vector3 &vec, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z)
+                { this->node_->setDirection(vec, relativeTo, localDirectionVector); }
+            inline void lookAt(const Vector3 &targetPoint, Ogre::Node::TransformSpace relativeTo, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z)
+                { this->node_->lookAt(targetPoint, relativeTo, localDirectionVector); }
+
+            inline void attachObject(Ogre::MovableObject *obj)
+                { this->node_->attachObject(obj); }
+            inline void detachObject(Ogre::MovableObject *obj)
+                { this->node_->detachObject(obj); }
+            inline void detachAllObjects()
+                { this->node_->detachAllObjects(); }
+
+            inline void setVelocity(const Vector3& velocity)
+                { this->velocity_ = velocity; }
+            inline void setVelocity(Real x, Real y, Real z)
+                { this->velocity_.x = x; this->velocity_.y = y; this->velocity_.z = z; }
+            inline const Vector3& getVelocity() const
+                { return this->velocity_; }
+
+            inline void setAcceleration(const Vector3& acceleration)
+                { this->acceleration_ = acceleration; }
+            inline void setAcceleration(Real x, Real y, Real z)
+                { this->acceleration_.x = x; this->acceleration_.y = y; this->acceleration_.z = z; }
+            inline const Vector3& getAcceleration() const
+                { return this->acceleration_; }
+
+            inline void setRotationAxis(const Vector3& axis)
+                { this->rotationAxis_ = axis; }
+            inline void setRotationAxis(Real x, Real y, Real z)
+                { this->rotationAxis_.x = x; this->rotationAxis_.y = y; this->rotationAxis_.z = z; }
+            inline const Vector3& getRotationAxis() const
+                { return this->rotationAxis_; }
+
+            inline void setRotationRate(const Radian& angle)
+                { this->rotationRate_ = angle; }
+            inline void setRotationRate(const Degree& angle)
+                { this->rotationRate_ = angle; }
+            inline const Radian& getRotationRate() const
+                { return this->rotationRate_; }
+
+            inline void setMomentum(const Radian& angle)
+                { this->momentum_ = angle; }
+            inline void setMomentum(const Degree& angle)
+                { this->momentum_ = angle; }
+            inline const Radian& getMomentum() const
+                { return this->momentum_; }
+
+
+            static Ogre::SceneManager* sceneManager_s;
+            static int num_s;
+
+        private:
+            Ogre::SceneNode* node_;
+            static unsigned int worldEntityCounter_s;
+
+            bool bStatic_;
+            Vector3 velocity_;
+            Vector3 acceleration_;
+            Vector3 rotationAxis_;
+            Radian rotationRate_;
+            Radian momentum_;
+    };
+}
+
+#endif
