Index: code/branches/releasetodo/src/orxonox/LevelInfo.cc
===================================================================
--- code/branches/releasetodo/src/orxonox/LevelInfo.cc	(revision 7626)
+++ code/branches/releasetodo/src/orxonox/LevelInfo.cc	(revision 7626)
@@ -0,0 +1,185 @@
+/*
+ *   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:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "LevelInfo.h"
+
+#include <sstream>
+#include <vector>
+
+#include "util/SubString.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+#include "LevelManager.h"
+
+namespace orxonox
+{
+
+    // LevelInfoItem
+
+    /**
+    @brief
+        Default constructor.
+    */
+    LevelInfoItem::LevelInfoItem()
+    {
+
+    }
+
+    /**
+    @brief
+        Constructor. Initializes the object.
+    @param name
+        The name of the Level.
+    @param filename
+        The XML-filename of the Level.
+    */
+    LevelInfoItem::LevelInfoItem(const std::string& name, const std::string filename)
+    {
+        this->setName(name);
+        this->setXMLFilename(filename);
+    }
+
+    /**
+    @brief
+        Destructor.
+    */
+    LevelInfoItem::~LevelInfoItem()
+    {
+
+    }
+
+    /**
+    @brief
+        Set the tags the Level is tagged with.
+    @param tags
+        A comma-seperated string of all the tags to be set.
+    */
+    void LevelInfoItem::setTags(const std::string& tags)
+    {
+        SubString substr = SubString(tags, ",", " "); // Split the string into tags.
+        const std::vector<std::string>& strings = substr.getAllStrings();
+        for(std::vector<std::string>::const_iterator it = strings.begin(); it != strings.end(); it++)
+            this->addTag(*it, false);
+
+        this->tagsUpdated();
+    }
+
+    /**
+    @brief
+        Add a tag to the set of tags the Level is tagged with.
+    @param tag
+        The tag to be added.
+    @param update
+        Whether the comma-seperated string of all tags should be updated. Default is true.
+    @return
+        Returns true if the tag was successfully added, if the tag was already present it returns false.
+    */
+    bool LevelInfoItem::addTag(const std::string& tag, bool update)
+    {
+        bool success = this->tags_.insert(std::string(tag)).second;
+        if(update && success)
+            this->tagsUpdated();
+        return success;
+    }
+
+    /**
+    @brief
+        Updates the comma-seperated string of all tags, if the set of tags has changed.
+    */
+    void LevelInfoItem::tagsUpdated(void)
+    {
+        std::stringstream stream;
+        std::set<std::string>::iterator temp;
+        for(std::set<std::string>::iterator it = this->tags_.begin(); it != this->tags_.end(); )
+        {
+            temp = it;
+            if(++it == this->tags_.end()) // If this is the last tag we don't add a comma.
+                stream << *temp;
+            else
+                stream << *temp << ", ";
+        }
+
+        this->tagsString_ = std::string(stream.str());
+    }
+
+    // LevelInfo
+
+    CreateFactory(LevelInfo);
+
+    /**
+    @brief
+
+    @param creator
+        The creator of this object.
+    */
+    LevelInfo::LevelInfo(BaseObject* creator) : BaseObject(creator)
+    {
+        RegisterObject(LevelInfo);
+
+        this->xmlfilename_ = this->getFilename();
+    }
+
+    /**
+    @brief
+        Destructor.
+    */
+    LevelInfo::~LevelInfo()
+    {
+
+    }
+
+    /**
+    @brief
+        Creates a LevelInfo object through XML.
+    */
+    void LevelInfo::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(LevelInfo, XMLPort, xmlelement, mode);
+
+        XMLPortParam(LevelInfo, "description", setDescription, getDescription, xmlelement, mode);
+        XMLPortParam(LevelInfo, "tags", setTags, getTags, xmlelement, mode);
+    }
+
+    /**
+    @brief
+        Copies the contents of this LevelInfo object to a new LevelInfoItem object.
+        This is needed, because a LeveInfo object is only created within the scope of the XML-file it is loaded with and is destroyed once that is unloaded.
+    @return
+        Returns a new LevelInfoItem with the same contents as the LevelInfo object.
+    */
+    LevelInfoItem* LevelInfo::copy(void)
+    {
+        LevelInfoItem* info = new LevelInfoItem(this->BaseObject::getName(), this->getXMLFilename());
+        info->setDescription(this->getDescription());
+        info->setTags(this->getTags());
+        return info;
+    }
+
+}
+
Index: code/branches/releasetodo/src/orxonox/LevelInfo.h
===================================================================
--- code/branches/releasetodo/src/orxonox/LevelInfo.h	(revision 7625)
+++ code/branches/releasetodo/src/orxonox/LevelInfo.h	(revision 7626)
@@ -44,6 +44,6 @@
 #include "core/OrxonoxClass.h"
 
-namespace orxonox
-{
+namespace orxonox // tolua_export
+{ // tolua_export
 
     /**
@@ -55,6 +55,7 @@
         Damian 'Mozork' Frick
     */
-    class _OrxonoxExport LevelInfoItem : virtual public OrxonoxClass
-    {
+    class _OrxonoxExport LevelInfoItem // tolua_export
+        : virtual public OrxonoxClass
+    { // tolua_export
         public:
             LevelInfoItem(); //!< Default constructor.
@@ -72,6 +73,5 @@
             @return Returns the name of the Level.
             */
-            inline const std::string& getName(void)
-                { return this->name_; }
+            inline const std::string& getName(void) { return this->name_; } // tolua_export
 
             /**
@@ -85,6 +85,5 @@
             @return Returns the description of the Level.
             */
-            inline const std::string& getDescription() const
-                { return this->description_; }
+            inline const std::string& getDescription() const { return this->description_; } // tolua_export
 
             void setTags(const std::string& tags); //!< Set the tags the Level is tagged with.
@@ -101,6 +100,5 @@
             @return Returns true if the Level is tagged with the input tag.
             */
-            bool hasTag(const std::string& tag) const
-                { return this->tags_.find(tag) != this->tags_.end(); }
+            inline bool hasTag(const std::string& tag) const { return this->tags_.find(tag) != this->tags_.end(); } // tolua_export
 
             /**
@@ -108,6 +106,5 @@
             @return Returns the XML-filename (including *.oxw extension) of the Level.
             */
-            inline const std::string& getXMLFilename(void)
-                { return this->xmlfilename_; }
+            inline const std::string& getXMLFilename(void) { return this->xmlfilename_; } // tolua_export
 
         protected:
@@ -128,5 +125,5 @@
             std::set<std::string> tags_; //!< The set of tags the Level is tagged with.
             std::string tagsString_; //!< The comma-seperated string of all the tags the Level is tagged with.
-    };
+    }; // tolua_export
 
     /**
@@ -188,5 +185,5 @@
 
     };
-}
+} // tolua_export
 
 #endif /* _LevelInfo_H__ */
Index: code/branches/releasetodo/src/orxonox/LevelManager.cc
===================================================================
--- code/branches/releasetodo/src/orxonox/LevelManager.cc	(revision 7625)
+++ code/branches/releasetodo/src/orxonox/LevelManager.cc	(revision 7626)
@@ -134,18 +134,15 @@
         this->updateAvailableLevelList();
 
-        COUT(0) << "Number of Levels: " << this->infos_.size() << std::endl;
-
         return this->availableLevels_.size();
     }
 
-    const std::string& LevelManager::getAvailableLevelListItem(unsigned int index) const
+    LevelInfoItem* LevelManager::getAvailableLevelListItem(unsigned int index) const
     {
         if (index >= this->availableLevels_.size())
-            return BLANKSTRING;
+            return NULL;
         else
         {
             std::map<std::string, LevelInfoItem*>::const_iterator it = this->infos_.find(this->availableLevels_[index]);
-            assert(it->second);
-            return it->second->getName();
+            return it->second;
         }
     }
@@ -172,5 +169,4 @@
                 {
                     LevelInfoItem* info = item->copy();
-                    COUT(0) << "BUUUUUUUUUH: " << info->getName() << " | " << info->getXMLFilename() << " | " << it->substr(0, pos) << std::endl;
                     if(info->getXMLFilename() == *it)
                     {
Index: code/branches/releasetodo/src/orxonox/LevelManager.h
===================================================================
--- code/branches/releasetodo/src/orxonox/LevelManager.h	(revision 7625)
+++ code/branches/releasetodo/src/orxonox/LevelManager.h	(revision 7626)
@@ -61,5 +61,5 @@
             const std::string& getDefaultLevel() const; //tolua_export
             unsigned int getNumberOfLevels(void); //tolua_export
-            const std::string& getAvailableLevelListItem(unsigned int index) const; //tolua_export
+            LevelInfoItem* getAvailableLevelListItem(unsigned int index) const; //tolua_export
 
             static LevelManager& getInstance()    { return Singleton<LevelManager>::getInstance(); } // tolua_export
