Index: code/trunk/src/modules/questsystem/AddQuest.cc
===================================================================
--- code/trunk/src/modules/questsystem/AddQuest.cc	(revision 6906)
+++ code/trunk/src/modules/questsystem/AddQuest.cc	(revision 7163)
@@ -68,5 +68,5 @@
         SUPER(AddQuest, XMLPort, xmlelement, mode);
 
-        COUT(3) << "New AddQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;
+        COUT(4) << "New AddQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;
     }
 
@@ -87,5 +87,5 @@
         }
 
-        COUT(3) << "AddQuest on player: " << player << " ." << std::endl;
+        COUT(5) << "AddQuest on player: " << player << " ." << std::endl;
 
         try
@@ -103,5 +103,5 @@
         }
 
-        COUT(3) << "Quest {" << this->getQuestId() << "} successfully added to player: " << player << " ." << std::endl;
+        COUT(4) << "Quest {" << this->getQuestId() << "} successfully added to player: " << player << " ." << std::endl;
         return true;
     }
Index: code/trunk/src/modules/questsystem/AddQuestHint.cc
===================================================================
--- code/trunk/src/modules/questsystem/AddQuestHint.cc	(revision 6906)
+++ code/trunk/src/modules/questsystem/AddQuestHint.cc	(revision 7163)
@@ -72,5 +72,5 @@
         XMLPortParam(AddQuestHint, "hintId", setHintId, getHintId, xmlelement, mode);
 
-        COUT(3) << "New AddQuestHint, with target QuestHint {" << this->getHintId() << "}, created." << std::endl;
+        COUT(4) << "New AddQuestHint, with target QuestHint {" << this->getHintId() << "}, created." << std::endl;
     }
 
@@ -85,5 +85,5 @@
     bool AddQuestHint::setHintId(const std::string & id)
     {
-        if(!QuestItem::isId(id))
+        if(id.compare(BLANKSTRING) == 0)
         {
             COUT(2) << "Invalid id. QuestItem id {" << id << "} could not be set." << std::endl;
@@ -111,5 +111,5 @@
         }
 
-        COUT(3) << "AddQuestHint on player: " << player << " ." << std::endl;
+        COUT(5) << "AddQuestHint on player: " << player << " ." << std::endl;
 
         try
@@ -127,5 +127,5 @@
         }
 
-        COUT(3) << "QuestHint {" << this->getHintId() << "} successfully added to player: " << player << " ." << std::endl;
+        COUT(4) << "QuestHint {" << this->getHintId() << "} successfully added to player: " << player << " ." << std::endl;
         return true;
 
Index: code/trunk/src/modules/questsystem/AddReward.cc
===================================================================
--- code/trunk/src/modules/questsystem/AddReward.cc	(revision 6906)
+++ code/trunk/src/modules/questsystem/AddReward.cc	(revision 7163)
@@ -68,5 +68,5 @@
         XMLPortObject(AddReward, Rewardable, "", addRewardable, getRewardables, xmlelement, mode);
 
-        COUT(3) << "New AddReward, with " << this->rewards_.size() << " Rewardables created." << std::endl;
+        COUT(4) << "New AddReward, with " << this->rewards_.size() << " Rewardables created." << std::endl;
     }
 
@@ -103,5 +103,5 @@
     bool AddReward::invoke(PlayerInfo* player)
     {
-        COUT(3) << "AddReward on player: " << player << " ." << std::endl;
+        COUT(5) << "AddReward on player: " << player << " ." << std::endl;
 
         bool check = true;
@@ -111,5 +111,5 @@
         }
 
-        COUT(3) << "Rewardable successfully added to player." << player << " ." << std::endl;
+        COUT(4) << "Rewardable successfully added to player." << player << " ." << std::endl;
 
         return check;
Index: code/trunk/src/modules/questsystem/CMakeLists.txt
===================================================================
--- code/trunk/src/modules/questsystem/CMakeLists.txt	(revision 6906)
+++ code/trunk/src/modules/questsystem/CMakeLists.txt	(revision 7163)
@@ -12,6 +12,4 @@
   QuestEffect.cc
   QuestEffectBeacon.cc
-  QuestGUINode.cc
-  QuestGUI.cc
   QuestHint.cc
   QuestItem.cc
@@ -28,6 +26,7 @@
   TOLUA_FILES
     QuestManager.h
-  DEFINE_SYMBOL
-    "QUESTSYSTEM_SHARED_BUILD"
+    QuestDescription.h
+    Quest.h
+    QuestHint.h
   PCH_FILE
     QuestsystemPrecompiledHeaders.h
Index: code/trunk/src/modules/questsystem/ChangeQuestStatus.cc
===================================================================
--- code/trunk/src/modules/questsystem/ChangeQuestStatus.cc	(revision 6906)
+++ code/trunk/src/modules/questsystem/ChangeQuestStatus.cc	(revision 7163)
@@ -78,5 +78,5 @@
     bool ChangeQuestStatus::setQuestId(const std::string & id)
     {
-        if(!QuestItem::isId(id))
+        if(id.compare(BLANKSTRING) == 0)
         {
             COUT(2) << "Invalid id. QuestItem id {" << id << "} could not be set." << std::endl;
Index: code/trunk/src/modules/questsystem/CompleteQuest.cc
===================================================================
--- code/trunk/src/modules/questsystem/CompleteQuest.cc	(revision 6906)
+++ code/trunk/src/modules/questsystem/CompleteQuest.cc	(revision 7163)
@@ -68,5 +68,5 @@
         SUPER(CompleteQuest, XMLPort, xmlelement, mode);
 
-        COUT(3) << "New CompleteQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;
+        COUT(4) << "New CompleteQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;
     }
 
@@ -87,5 +87,5 @@
         }
 
-        COUT(3) << "CompleteQuest on player: " << player << " ." << std::endl;
+        COUT(5) << "CompleteQuest on player: " << player << " ." << std::endl;
 
         Quest* quest;
@@ -105,5 +105,5 @@
         }
 
-        COUT(3) << "Quest {" << quest->getId() << "} successfully completed by player: " << player << " ." << std::endl;
+        COUT(4) << "Quest {" << quest->getId() << "} successfully completed by player: " << player << " ." << std::endl;
         return true;
     }
Index: code/trunk/src/modules/questsystem/FailQuest.cc
===================================================================
--- code/trunk/src/modules/questsystem/FailQuest.cc	(revision 6906)
+++ code/trunk/src/modules/questsystem/FailQuest.cc	(revision 7163)
@@ -68,5 +68,5 @@
         SUPER(FailQuest, XMLPort, xmlelement, mode);
 
-        COUT(3) << "New FailQUest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;
+        COUT(4) << "New FailQUest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;
     }
 
@@ -87,5 +87,5 @@
         }
 
-        COUT(3) << "FailQuest on player: " << player << " ." << std::endl;
+        COUT(4) << "FailQuest on player: " << player << " ." << std::endl;
 
         Quest* quest;
@@ -104,5 +104,5 @@
         }
 
-        COUT(3) << "Quest {" << quest->getId() << "} failed by player: " << player << " ." << std::endl;
+        COUT(4) << "Quest {" << quest->getId() << "} failed by player: " << player << " ." << std::endl;
         return true;
     }
Index: code/trunk/src/modules/questsystem/GlobalQuest.cc
===================================================================
--- code/trunk/src/modules/questsystem/GlobalQuest.cc	(revision 6906)
+++ code/trunk/src/modules/questsystem/GlobalQuest.cc	(revision 7163)
@@ -70,5 +70,5 @@
         XMLPortObject(GlobalQuest, QuestEffect, "reward-effects", addRewardEffect, getRewardEffects, xmlelement, mode);
 
-        COUT(3) << "New GlobalQuest {" << this->getId() << "} created." << std::endl;
+        COUT(4) << "New GlobalQuest {" << this->getId() << "} created." << std::endl;
     }
 
@@ -253,5 +253,5 @@
         this->rewards_.push_back(effect); //!< Add the QuestEffect to the list.
 
-        COUT(3) << "Reward effect was added to Quest {" << this->getId() << "}." << std::endl;
+        COUT(4) << "Reward effect was added to Quest {" << this->getId() << "}." << std::endl;
         return true;
     }
Index: code/trunk/src/modules/questsystem/LocalQuest.cc
===================================================================
--- code/trunk/src/modules/questsystem/LocalQuest.cc	(revision 6906)
+++ code/trunk/src/modules/questsystem/LocalQuest.cc	(revision 7163)
@@ -68,5 +68,5 @@
         SUPER(LocalQuest, XMLPort, xmlelement, mode);
 
-        COUT(3) << "New LocalQuest {" << this->getId() << "} created." << std::endl;
+        COUT(4) << "New LocalQuest {" << this->getId() << "} created." << std::endl;
     }
 
Index: code/trunk/src/modules/questsystem/Quest.cc
===================================================================
--- code/trunk/src/modules/questsystem/Quest.cc	(revision 6906)
+++ code/trunk/src/modules/questsystem/Quest.cc	(revision 7163)
@@ -61,5 +61,6 @@
     Quest::~Quest()
     {
-
+        if(this->isRegistered())
+            QuestManager::getInstance().unregisterQuest(this);
     }
 
@@ -98,5 +99,5 @@
         this->parentQuest_ = quest;
 
-        COUT(3) << "Parent Quest {" << quest->getId() << "} was added to Quest {" << this->getId() << "}." << std::endl;
+        COUT(4) << "Parent Quest {" << quest->getId() << "} was added to Quest {" << this->getId() << "}." << std::endl;
         return true;
     }
@@ -121,5 +122,5 @@
         this->subQuests_.push_back(quest); //!< Adds the Quest to the end of the list of subquests.
 
-        COUT(3) << "Sub Quest {" << quest->getId() << "} was added to Quest {" << this->getId() << "}." << std::endl;
+        COUT(4) << "Sub Quest {" << quest->getId() << "} was added to Quest {" << this->getId() << "}." << std::endl;
         return true;
     }
@@ -145,5 +146,5 @@
         this->hints_.push_back(hint); //!< Adds the QuestHint to the end of the list of QuestHints.
 
-        COUT(3) << "QuestHint {" << hint->getId() << "} was added to Quest {" << this->getId() << "}." << std::endl;
+        COUT(4) << "QuestHint {" << hint->getId() << "} was added to Quest {" << this->getId() << "}." << std::endl;
         return true;
     }
@@ -167,5 +168,5 @@
         this->failEffects_.push_back(effect); //!< Adds the QuestEffect to the end of the list of fail QuestEffects.
 
-        COUT(3) << "A FailEffect was added to Quest {" << this->getId() << "}." << std::endl;
+        COUT(4) << "A FailEffect was added to Quest {" << this->getId() << "}." << std::endl;
         return true;
     }
@@ -189,5 +190,5 @@
         this->completeEffects_.push_back(effect); //!< Adds the QuestEffect to the end of the list of complete QuestEffects.
 
-        COUT(3) << "A CompleteEffect was added to Quest {" << this->getId() << "}." << std::endl;
+        COUT(4) << "A CompleteEffect was added to Quest {" << this->getId() << "}." << std::endl;
         return true;
     }
Index: code/trunk/src/modules/questsystem/Quest.h
===================================================================
--- code/trunk/src/modules/questsystem/Quest.h	(revision 6906)
+++ code/trunk/src/modules/questsystem/Quest.h	(revision 7163)
@@ -41,6 +41,6 @@
 #include "QuestItem.h"
 
-namespace orxonox
-{
+namespace orxonox // tolua_export
+{ // tolua_export
     namespace QuestStatus
     {
@@ -67,6 +67,7 @@
         Damian 'Mozork' Frick
     */
-    class _QuestsystemExport Quest : public QuestItem
-    {
+    class _QuestsystemExport Quest // tolua_export
+        : public QuestItem
+    { // tolua_export
         public:
             Quest(BaseObject* creator);
@@ -97,7 +98,7 @@
 
             bool isInactive(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'inactive'.
-            bool isActive(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'active'.
-            bool isFailed(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'failed'.
-            bool isCompleted(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'completed'.
+            bool isActive(const orxonox::PlayerInfo* player) const; // tolua_export //!< Returns true if the quest status for the specific player is 'active'.
+            bool isFailed(const orxonox::PlayerInfo* player) const; // tolua_export //!< Returns true if the quest status for the specific player is 'failed'.
+            bool isCompleted(const orxonox::PlayerInfo* player) const; // tolua_export //!< Returns true if the quest status for the specific player is 'completed'.
 
             bool start(PlayerInfo* player); //!< Sets a Quest to active.
@@ -151,7 +152,7 @@
             bool addCompleteEffect(QuestEffect* effect); //!< Adds an QuestEffect to the list of complete QuestEffects.
 
-    };
+    }; // tolua_export
 
-}
+} // tolua_export
 
 #endif /* _Quest_H__ */
Index: code/trunk/src/modules/questsystem/QuestDescription.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestDescription.cc	(revision 6906)
+++ code/trunk/src/modules/questsystem/QuestDescription.cc	(revision 7163)
@@ -74,5 +74,5 @@
         XMLPortParam(QuestDescription, "completeMessage", setCompleteMessage, getCompleteMessage, xmlelement, mode);
 
-        COUT(3) << "New QuestDescription with title '" << this->getTitle() << "' created." << std::endl;
+        COUT(4) << "New QuestDescription with title '" << this->getTitle() << "' created." << std::endl;
     }
 
@@ -89,5 +89,5 @@
         Make sure the messages meet the conditions.
     */
-    bool QuestDescription::notificationHelper(const std::string & item, const std::string & status) const
+    bool QuestDescription::notificationHelper(const std::string & item, const std::string & status)
     {
         std::string message;
@@ -122,5 +122,5 @@
         }
 
-        QuestNotification* notification = new QuestNotification(message);
+        QuestNotification* notification = new QuestNotification(this, message);
         notification->send();
         return true;
Index: code/trunk/src/modules/questsystem/QuestDescription.h
===================================================================
--- code/trunk/src/modules/questsystem/QuestDescription.h	(revision 6906)
+++ code/trunk/src/modules/questsystem/QuestDescription.h	(revision 7163)
@@ -83,5 +83,5 @@
             @return Returns a string containing the fail message of the QuestDescription.
             */
-            inline const std::string & getFailMessage(void) const
+            inline const std::string & getFailMessage(void)
                 { return this->failMessage_; }
 
@@ -90,5 +90,5 @@
             @return Returns a string containing the complete message of the QuestDescription.
             */
-            inline const std::string & getCompleteMessage(void) const
+            inline const std::string & getCompleteMessage(void)
                 { return this->completeMessage_; }
 
@@ -97,5 +97,5 @@
             @return Returns true if successful.
             */
-            inline bool sendAddHintNotification(void) const
+            inline bool sendAddHintNotification(void)
                 { return notificationHelper("hint", ""); }
 
@@ -104,5 +104,5 @@
             @return Returns true if successful.
             */
-            inline bool sendAddQuestNotification(void) const
+            inline bool sendAddQuestNotification(void)
                 { return notificationHelper("quest", "start"); }
 
@@ -111,5 +111,5 @@
             @return Returns true if successful.
             */
-            inline bool sendFailQuestNotification(void) const
+            inline bool sendFailQuestNotification(void)
                 { return notificationHelper("quest", "fail"); }
 
@@ -118,5 +118,5 @@
             @return Returns true if successful.
             */
-            inline bool sendCompleteQuestNotification(void) const
+            inline bool sendCompleteQuestNotification(void)
                 { return notificationHelper("quest", "complete"); }
 
@@ -127,5 +127,5 @@
             std::string completeMessage_; //!< The message displayed when the Quest is completed.
 
-            bool notificationHelper(const std::string & item, const std::string & status) const; //!< Helper for sending QuestDescriptions as Notifications.
+            bool notificationHelper(const std::string & item, const std::string & status); //!< Helper for sending QuestDescriptions as Notifications.
 
             /**
Index: code/trunk/src/modules/questsystem/QuestEffectBeacon.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestEffectBeacon.cc	(revision 6906)
+++ code/trunk/src/modules/questsystem/QuestEffectBeacon.cc	(revision 7163)
@@ -78,5 +78,5 @@
         XMLPortEventSink(QuestEffectBeacon, BaseObject, "execute", execute, xmlelement, mode); //TODO: Change BaseObject to MultiTrigger as soon as MultiTrigger is the base of all triggers.
 
-        COUT(3) << "New QuestEffectBeacon created." << std::endl;
+        COUT(4) << "New QuestEffectBeacon created." << std::endl;
     }
 
@@ -112,10 +112,10 @@
         MultiTriggerContainer* mTrigger = orxonox_cast<MultiTriggerContainer*>(trigger);
         Pawn* pawn = NULL;
-        
+
         //! If the trigger is neither a Playertrigger nor a MultiTrigger (i.e. a MultitriggerContainer) we can do anything with it.
         if(pTrigger == NULL && mTrigger == NULL)
             return false;
-        
-        // If the trigger is a PlayerTrigger.        
+
+        // If the trigger is a PlayerTrigger.
         if(pTrigger != NULL)
         {
@@ -125,5 +125,5 @@
                 pawn = pTrigger->getTriggeringPlayer();
         }
-        
+
         // If the trigger is a MultiTrigger (i.e. a MultiTriggerContainer)
         if(mTrigger != NULL)
@@ -134,5 +134,5 @@
         if(pawn == NULL)
         {
-            COUT(2) << "The QuestEffectBeacon was triggered by an entity other than a Pawn." << std::endl;
+            COUT(4) << "The QuestEffectBeacon was triggered by an entity other than a Pawn. (" << trigger->getIdentifier()->getName() << ")" << std::endl;
             return false;
         }
@@ -147,5 +147,5 @@
         }
 
-        COUT(3) << "QuestEffectBeacon executed on player: " << player << " ." << std::endl;
+        COUT(4) << "QuestEffectBeacon executed on player: " << player << " ." << std::endl;
 
         bool check = QuestEffect::invokeEffects(player, this->effects_); //!< Invoke the QuestEffects on the PlayerInfo.
@@ -249,5 +249,5 @@
         this->effects_.push_back(effect);
 
-        COUT(3) << "A QuestEffect was added to a QuestEffectBeacon." << std::endl;
+        COUT(4) << "A QuestEffect was added to a QuestEffectBeacon." << std::endl;
         return true;
     }
Index: code/trunk/src/modules/questsystem/QuestGUI.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestGUI.cc	(revision 6906)
+++ 	(revision )
@@ -1,274 +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:
- *      Damian 'Mozork' Frick
- *   Co-authors:
- *      ...
- *
- */
-
-#include "QuestGUI.h"
-
-#include <sstream>
-#include <CEGUIWindow.h>
-#include <CEGUIWindowManager.h>
-
-#include "core/CoreIncludes.h"
-#include "Quest.h"
-#include "QuestHint.h"
-#include "QuestItem.h"
-#include "QuestGUINode.h"
-#include "QuestManager.h"
-
-namespace orxonox {
-
-    /**
-    @brief
-        Constructor. Registers and initializes the object.
-    @param
-        The player the GUI is for.
-    */
-    QuestGUI::QuestGUI(PlayerInfo* player)
-    {
-        RegisterRootObject(QuestGUI);
-
-        this->player_ = player;
-        this->windowManager_ = CEGUI::WindowManager::getSingletonPtr(); //!< Get CEGUI WindowManager.
-        this->rootWindow_ = NULL;
-        this->root_ = new QuestGUINode(); //!< Create empty root node.
-
-        COUT(3) << "New QuestGUI created." << std::endl;
-    }
-
-    /**
-    @brief
-        Destructor.
-    */
-    QuestGUI::~QuestGUI()
-    {
-        COUT(3) << "Destroying QuestGUI..." << std::endl;
-
-        this->clear(); //!< Clearing the GUI and in the process destroying all QuestGUINodes.
-
-        //! Destroying the windows in the this->windows_ list.
-        for(std::list<CEGUI::Window*>::iterator it = this->windows_.begin(); it != this->windows_.end(); it++)
-        {
-            if(*it != NULL)
-                (*it)->destroy();
-        }
-        this->windows_.clear();
-
-        if(this->root_ != NULL)
-            this->root_->destroy();
-    }
-
-    /**
-    @brief
-        Get the root CEGUI Window of the GUI.
-    @return
-        Returns the root CEGUI Window of the GUI.
-    */
-    CEGUI::Window* QuestGUI::getGUI(void)
-    {
-        this->update(); //!< Update the GUI.
-
-        return this->rootWindow_;
-    }
-
-    /**
-    @brief
-        Update the GUI.
-    */
-    void QuestGUI::update(void)
-    {
-        COUT(3) << "Updating QuestGUI..." << std::endl;
-
-        this->clear(); //!< Clear the GUI.
-
-        int depth = 0;
-        int index = 0;
-
-        //! Create root window.
-        this->rootWindow_ = this->windowManager_->createWindow("MenuWidgets/ScrollablePane", "QuestGUI/Quests");
-        this->rootWindow_->setSize(CEGUI::UVector2(CEGUI::UDim(1, 0),CEGUI::UDim(1, 0)));
-
-        //! Iterate through all Quests.
-        std::map<std::string, Quest*> quests = QuestManager::getInstance().getQuests();
-        for(std::map<std::string, Quest*>::iterator it = quests.begin(); it != quests.end(); it++)
-        {
-            Quest* quest = it->second;
-            if(quest->getParentQuest() == NULL && !quest->isInactive(this->player_)) //!< If the Quest isn't inactive and a root Quest (meaning it has no parent.), create a Node.
-            {
-                index = createNode(this->root_, quest, depth, index);
-            }
-        }
-        COUT(3) << "Updating QuestGUI done." << std::endl;
-    }
-
-    /**
-    @brief
-        Clear the QuestGUI.
-    */
-    void QuestGUI::clear(void)
-    {
-        COUT(3) << "Clearing QuestGUI..." << std::endl;
-
-        //! Clear all nodes.
-        for(std::map<CEGUI::Window*, QuestGUINode*>::iterator it = this->nodes_.begin(); it != this->nodes_.end(); it++)
-        {
-            QuestGUINode* node = it->second;
-            if(node == NULL)
-            {
-                COUT(1) << "Node is NULL!";
-                continue;
-            }
-            std::string* str = new std::string();
-            node->getName(*str);
-            COUT(3) << "Clearing Node '" << *str << "' ..." << std::endl;
-            delete str;
-            node->destroy();
-        }
-        this->nodes_.clear();
-
-        //! Clear root window.
-        if(this->rootWindow_ != NULL)
-            this->rootWindow_->destroy();
-
-        COUT(3) << "Clearing QuestGUI done." << std::endl;
-    }
-
-    /**
-    @brief
-        Get a CEGUI Window to use.
-        Windows that are no longer used are collected with giveWindow, and are given out again with getWindow, so save some time recreating new windows everytime.
-        The retreived window is of type "MenuWidgets/TabButton".
-    @return
-        Returns a CEGUI Window of type "MenuWidgets/TabButton".
-    */
-    CEGUI::Window* QuestGUI::getWindow(void)
-    {
-        if(!this->windows_.empty()) //!< If there are windows in the list.
-        {
-            CEGUI::Window* window = this->windows_.back();
-            this->windows_.pop_back();
-            return window;
-        }
-
-        //!< Else create a new one.
-        std::ostringstream stream;
-        stream << "QuestGUI/Quests/EmptyWindows/" << this->windows_.size()+1;
-        return this->windowManager_->createWindow("MenuWidgets/TabButton", stream.str());
-    }
-
-    /**
-    @brief
-        Return a no longer needed CEGUI Window for reuse.
-    @param window
-        The CEGUI window ot be returned.
-    */
-    void QuestGUI::giveWindow(CEGUI::Window* window)
-    {
-        if(window == NULL)
-            return;
-        this->windows_.push_back(window);
-        this->rootWindow_->removeChildWindow(window); //!< Remove the window as child of the rootWindow.
-        std::ostringstream stream;
-        stream << "QuestGUI/Quests/EmptyWindows/" << this->windows_.size();
-        window->rename(stream.str());
-    }
-
-    /**
-    @brief
-        Finde the QuestGUINode belonging to the input CEGUI Window.
-    @param window
-        A pointer to a CEGUI Window.
-    @return
-        A pointer to the QuestGUI Node belonging to the input CEGUI Window.
-    */
-    /*static*/ QuestGUINode* QuestGUI::findNode(CEGUI::Window* window)
-    {
-        for(std::map<PlayerInfo*, QuestGUI*>::iterator it = QuestManager::getInstance().questGUIs_.begin(); it != QuestManager::getInstance().questGUIs_.end(); it++)
-        {
-            QuestGUI* gui = it->second;
-            std::map<CEGUI::Window*, QuestGUINode*>::iterator node = gui->nodes_.find(window);
-            if(node != gui->nodes_.end()) return node->second;
-        }
-        return NULL;
-    }
-
-    /**
-    @brief
-        Recursive method to create Nodes for all Quests an Hints the given Quest is a parent to.
-    @param parent
-        Pointer to the parent QuestGUINode.
-    @param item
-        The QuestItem the QuestGUINode is created for.
-    @param depth
-        Parameter to define how much the list item has to be indented.
-    @param index
-        "Counter" for Quests and Hints.
-    @return
-        Returns the index.
-    */
-    int QuestGUI::createNode(QuestGUINode* parent, QuestItem* item, int depth, int index)
-    {
-        QuestGUINode* node = new QuestGUINode(this, parent, item, depth, index); //!< Create a new QuestGUINode.
-
-        this->nodes_.insert(std::pair<CEGUI::Window*, QuestGUINode*>(node->getWindow(),node)); //!< Insert the node and its window in the nodes_ map.
-
-        index++;
-
-        //! Check if the QuestItem is a Quest, if not (it's a QuestHint) it just returns.
-        Quest* quest = dynamic_cast<Quest*>(item);
-        if(quest == NULL)
-          return index;
-
-        //! Iterate through all subQuests.
-        std::list<Quest*> quests = quest->getSubQuestList();
-        for(std::list<Quest*>::iterator it = quests.begin(); it != quests.end(); it++)
-        {
-            Quest* quest = *it;
-            if(!quest->isInactive(this->player_)) //!< Add node if the subQuest is not inactive.
-            {
-                index = createNode(node, quest, depth+1, index);
-            }
-        }
-
-        //! Iterate through all hints.
-        std::list<QuestHint*> hints = quest->getHintsList();
-        int tempIndex = index; //!< Preserve the index, since for the hints we start anew with index 0.
-        index = 0;
-        for(std::list<QuestHint*>::iterator it = hints.begin(); it != hints.end(); it++)
-        {
-            QuestHint* hint = *it;
-            if(hint->isActive(this->player_)) //!< Add node if the hint is active.
-            {
-                index = createNode(node, hint, depth+1, index);
-            }
-        }
-        index = tempIndex; //!< Reset the index to the original level.
-
-        return index;
-    }
-
-}
-
Index: code/trunk/src/modules/questsystem/QuestGUI.h
===================================================================
--- code/trunk/src/modules/questsystem/QuestGUI.h	(revision 6906)
+++ 	(revision )
@@ -1,109 +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:
- *      Damian 'Mozork' Frick
- *   Co-authors:
- *      ...
- *
- */
-
-/**
-    @file
-    @brief Definition of the QuestGIU class.
-*/
-
-#ifndef _QuestGUI_H__
-#define _QuestGUI_H__
-
-#include "questsystem/QuestsystemPrereqs.h"
-
-#include <list>
-#include <map>
-#include <string>
-#include <CEGUIForwardRefs.h>
-
-#include "core/OrxonoxClass.h"
-
-namespace orxonox {
-
-    /**
-    @brief
-        Handles the GUI for the Questsystem.
-    @author
-        Damian 'Mozork' Frick
-    */
-    class _QuestsystemExport QuestGUI : public OrxonoxClass
-    {
-
-        public:
-
-            QuestGUI(PlayerInfo* player);
-            virtual ~QuestGUI();
-
-            void update(void); //!< Update the GUI.
-            CEGUI::Window* getGUI(void); //!< Get the root CEGUI Window of the GUI.
-
-            CEGUI::Window* getWindow(void); //!< Get a CEGUI Window to use.
-            void giveWindow(CEGUI::Window* window); //!< Return a no longer needed CEGUI Window for reuse.
-
-            static QuestGUINode* findNode(CEGUI::Window* window); //!< Finde the QuestGUINode belonging to the input CEGUI Window.
-
-            /**
-            @brief Retreive the CEGUI WindowManager.
-            @return Returns the CEGUI WindoWManager.
-            */
-            inline CEGUI::WindowManager* getWindowManager(void)
-                { return this->windowManager_; }
-            /**
-            @brief Retrieve the root window.
-            @return Returns the root window.
-            */
-            inline CEGUI::Window* getRootWindow(void)
-                { return this->rootWindow_; }
-            /**
-            @brief Retreive the player.
-            @return Returns the player.
-            */
-            inline PlayerInfo* getPlayer(void)
-                { return this->player_; }
-
-        private:
-
-            int createNode(QuestGUINode* parent, QuestItem* item, int depth, int index); //!< Recursive method to create Nodes for all Quests an Hints the given Quest is a parent to.
-
-            void clear(void); //!< Clear the QuestGUI.
-
-            QuestGUINode* root_; //!< An empty QuestGUINode being the parent of all otherwise parent-less nodes.
-
-            CEGUI::WindowManager* windowManager_; //!< The CEGUI WindowManager.
-            CEGUI::Window* rootWindow_; //!< The root CEGUI Window of the GUI.
-            PlayerInfo* player_; //!< The player that owns the GUI.
-
-            std::map<CEGUI::Window*, QuestGUINode*> nodes_; //!< A list of all QuestGUINodes, ordered by their respective CEGUI Windows.
-            std::list<CEGUI::Window*> windows_; //!< A list of windows to be used.
-
-    };
-
-}
-
-#endif /* _QuestGUI_H__ */
-
Index: code/trunk/src/modules/questsystem/QuestGUINode.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestGUINode.cc	(revision 6906)
+++ 	(revision )
@@ -1,399 +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:
- *      Damian 'Mozork' Frick
- *   Co-authors:
- *      ...
- *
- */
-
-#include "QuestGUINode.h"
-
-#include <sstream>
-
-#include <CEGUIWindowManager.h>
-#include <elements/CEGUIFrameWindow.h>
-#include <elements/CEGUIPushButton.h>
-#include <falagard/CEGUIFalWidgetLookFeel.h>
-#include <falagard/CEGUIFalWidgetLookManager.h>
-
-#include "core/CoreIncludes.h"
-#include "Quest.h"
-#include "QuestHint.h"
-#include "QuestItem.h"
-#include "QuestDescription.h"
-#include "QuestGUI.h"
-
-namespace orxonox {
-
-    /**
-    @brief
-        Default Constructor. Registers and initializes the object.
-    */
-    QuestGUINode::QuestGUINode(void)
-    {
-        this->initialize();
-    }
-
-    /**
-    @brief
-        Constructor. Registers and initializes the object.
-    @param gui
-        The QuestGUi the node beongs to.
-    @param parent
-        The parent node of the newly created node.
-    @param item
-        The QuestItem the  newly created node is for.
-    @param depth
-        Parameter to define how much the list item has to be indented.
-    @param index
-        "Counter" for Quests and Hints.
-    */
-    QuestGUINode::QuestGUINode(QuestGUI* gui, QuestGUINode* parent, QuestItem* item, int depth, int index)
-    {
-        this->initialize();
-
-        this->gui_ = gui;
-        this->parent_ = parent;
-        this->item_ = item;
-        this->depth_ = depth;
-        this->index_ = index;
-
-        this->createWindow();
-
-        COUT(3) << "New QuestGUINode '" << this->window_->getName() << "' created." << std::endl;
-    }
-
-    /**
-    @brief
-        Destructor.
-    @todo
-        Destroying everything?
-    */
-    QuestGUINode::~QuestGUINode(void)
-    {
-        if(this->window_ != NULL)
-            this->window_->destroy();
-        if(this->details_ != NULL)
-        {
-            this->details_->destroy();
-        }
-    }
-
-    /**
-    @brief
-        Initialize the object.
-    */
-    void QuestGUINode::initialize(void)
-    {
-        RegisterRootObject(QuestGUINode);
-
-        this->parent_ = NULL;
-        this->item_ = NULL;
-        this->window_ = NULL;
-        this->details_ = NULL;
-        this->depth_ = 0;
-        this->index_ = 0;
-        this->visible_ = true;
-    }
-
-    void QuestGUINode::toggleVisibility(void)
-    {
-
-    }
-
-    /**
-    @brief
-        Sets the input buffer to the name of the node.
-    @param buffer
-        The buffer that is set to the name of the node.
-    @todo
-        Needed?
-    */
-    void QuestGUINode::getName(std::string & buffer)
-    {
-        if(this->window_ != NULL)
-        {
-            buffer = this->window_->getName().c_str();
-        }
-        else
-        {
-            buffer.erase();
-        }
-    }
-
-    /**
-    @brief
-        Creates the details window.
-    @return
-        Returns the details window.
-    @todo
-        Return necessary?
-    */
-    CEGUI::Window* QuestGUINode::getDetails(void)
-    {
-
-        if(this->details_ == NULL) //!< If the details window was not already created.
-        {
-            std::ostringstream stream;
-
-            //! Create the main window for the details.
-            stream << this->window_->getName() << "/Details";
-            const QuestDescription* description = this->item_->getDescription();
-            this->details_ = this->gui_->getWindowManager()->createWindow("MenuWidgets/FrameWindow", stream.str());
-            this->details_->setSize(CEGUI::UVector2(CEGUI::UDim(0.7f, 0),CEGUI::UDim(0.7f, 0)));
-            this->details_->setPosition(CEGUI::UVector2(CEGUI::UDim(0.1f, 0),CEGUI::UDim(0.1f, 0)));
-            this->details_->setText(description->getTitle());
-            this->details_->setAlpha(1.0);
-            this->details_->setInheritsAlpha(false);
-            this->details_->setProperty("CloseButtonEnabled", "True");
-            this->details_->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked, CEGUI::Event::Subscriber(&QuestGUINode::closeDetails, this));
-
-            //! Create a ScrollablePane.
-            stream << "/Scrollable";
-            CEGUI::Window* window = this->gui_->getWindowManager()->createWindow("MenuWidgets/ScrollablePane", stream.str());
-            window->setSize(CEGUI::UVector2(CEGUI::UDim(1.0, -2*QuestGUINode::BORDER_WIDTH),CEGUI::UDim(1.0, -QuestGUINode::TITLE_HEIGHT)));
-            window->setPosition(CEGUI::UVector2(CEGUI::UDim(0, (float)QuestGUINode::BORDER_WIDTH),CEGUI::UDim(0, (float)QuestGUINode::TITLE_HEIGHT)));
-            this->details_->addChildWindow(window);
-
-            int height;
-            int offset = 0;
-
-            //! Display the status of the QuestItem if it is a Quest.
-            Quest* quest = dynamic_cast<Quest*>(this->item_);
-            if(quest != NULL) //!< If the QuestItem is a Quest
-            {
-                stream.str("");
-                stream << this->details_->getName() << "/Status";
-                CEGUI::Window* statusWindow = this->gui_->getWindowManager()->createWindow("MenuWidgets/StaticText", stream.str());
-                window->addChildWindow(statusWindow);
-                std::string status;
-                if(quest->isActive(this->gui_->getPlayer()))
-                {
-                    status = "This quest is active.";
-                }
-                else if(quest->isCompleted(this->gui_->getPlayer()))
-                {
-                    status = "This quest was completed.";
-                }
-                else if(quest->isFailed(this->gui_->getPlayer()))
-                {
-                    status = "This quest was failed.";
-                }
-                statusWindow->setProperty("HorzFormatting", "WordWrapLeftAligned");
-                statusWindow->setProperty("VertFormatting", "TopAligned");
-                statusWindow->setText(status);
-                statusWindow->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 0),CEGUI::UDim(0, (float)offset)));
-                statusWindow->setSize(CEGUI::UVector2(CEGUI::UDim(1.0, (float)-QuestGUINode::SCROLLBAR_WIDTH),CEGUI::UDim(1.0f, 0)));
-                height = setHeight(statusWindow);
-
-                offset += height;
-            }
-
-            //! Create title pane for the description.
-            stream.str("");
-            stream << this->details_->getName() << "/Description";
-            stream << "/Title";
-            CEGUI::Window* descriptionWindowTitle = this->gui_->getWindowManager()->createWindow("MenuWidgets/StaticText", stream.str());
-            window->addChildWindow(descriptionWindowTitle);
-            descriptionWindowTitle->setProperty("HorzFormatting", "HorzCentred");
-            descriptionWindowTitle->setProperty("VertFormatting", "TopAligned");
-            descriptionWindowTitle->setText("Description:");
-            descriptionWindowTitle->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 0),CEGUI::UDim(0, (float)offset)));
-            descriptionWindowTitle->setSize(CEGUI::UVector2(CEGUI::UDim(1.0f, -QuestGUINode::SCROLLBAR_WIDTH),CEGUI::UDim(1.0f, 0)));
-
-            offset += setHeight(descriptionWindowTitle);
-
-            //! Display the Description of the QuestItem.
-            stream.str("");
-            stream << this->details_->getName() << "/Description";
-            CEGUI::Window* descriptionWindow = this->gui_->getWindowManager()->createWindow("MenuWidgets/StaticText", stream.str());
-            window->addChildWindow(descriptionWindow);
-            descriptionWindow->setProperty("HorzFormatting", "WordWrapLeftAligned");
-            descriptionWindow->setProperty("VertFormatting", "TopAligned");
-            descriptionWindow->setText(description->getDescription());
-            descriptionWindow->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 0),CEGUI::UDim(0, (float)offset)));
-            descriptionWindow->setSize(CEGUI::UVector2(CEGUI::UDim(1.0, (float)-QuestGUINode::SCROLLBAR_WIDTH),CEGUI::UDim(1.0f, 0)));
-            height = setHeight(descriptionWindow);
-
-            offset += height;
-
-            //! Display a list of hints if the QuestItem is a Quest.
-            bool title = true;
-            if(quest != NULL)
-            {
-                for(std::list<QuestGUINode*>::iterator it = this->subNodes_.begin(); it != this->subNodes_.end(); it++)
-                {
-                    if(dynamic_cast<QuestHint*>((*it)->item_) != NULL) //!< If the subNode belongs to a QuestHint.
-                    {
-                        if(title) //!< If no title pane for the QuestHints has been created, create one.
-                        {
-                            stream.str("");
-                            stream << this->details_->getName() << "/Hints/Title";
-                            CEGUI::Window* hintsTitle = this->gui_->getWindowManager()->createWindow("MenuWidgets/StaticText", stream.str());
-                            window->addChildWindow(hintsTitle);
-                            hintsTitle->setProperty("HorzFormatting", "HorzCentred");
-                            hintsTitle->setProperty("VertFormatting", "TopAligned");
-                            hintsTitle->setText("Hints:");
-                            hintsTitle->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 0),CEGUI::UDim(0, (float)offset)));
-                            hintsTitle->setSize(CEGUI::UVector2(CEGUI::UDim(1.0, -QuestGUINode::SCROLLBAR_WIDTH),CEGUI::UDim(1.0, 0)));
-                            offset += setHeight(hintsTitle);;
-                            title = false;
-                        }
-                        QuestGUINode* node = *it;
-                        node->window_->setSize(CEGUI::UVector2(CEGUI::UDim(1.0f, (float)-QuestGUINode::SCROLLBAR_WIDTH),CEGUI::UDim(0, (float)QuestGUINode::BUTTON_HEIGHT)));
-                        node->window_->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 0),CEGUI::UDim(0, (float)offset)));
-                        window->addChildWindow(node->window_);
-                        offset += QuestGUINode::BUTTON_HEIGHT;
-                    }
-                }
-            }
-
-            COUT(3) << "Show Details: " << this->details_->getName() << std::endl;
-        }
-
-        return this->details_;
-    }
-
-    /**
-    @brief
-        Opens the details window for the Quest/QuestHint clicked on.
-    */
-    bool QuestGUINode::openDetails(const CEGUI::EventArgs& e)
-    {
-        COUT(3) << "Open QuestItem..." << std::endl;
-
-        //CEGUI::Window* window = this->gui_->getRootWindow();
-        CEGUI::Window* window = this->gui_->getWindowManager()->getWindow("orxonox/QuestGUI/Background");
-
-        if(window != NULL)
-            window->addChildWindow(this->getDetails());
-
-        return true;
-    }
-
-    /**
-    @brief
-        Close the details window.
-    */
-    bool QuestGUINode::closeDetails(const CEGUI::EventArgs& e)
-    {
-        //CEGUI::Window* window = this->gui_->getRootWindow();
-        CEGUI::Window* window = this->gui_->getWindowManager()->getWindow("orxonox/QuestGUI/Background");
-        window->removeChildWindow(this->details_);
-
-        return true;
-    }
-
-    /**
-    @brief
-        Helper method for setHeight(). Gets the StaticTextArea for an input CEGUI Window.
-    @param window
-        The CEGUI window.
-    @return
-        Returns a CEGUI Rect.
-    */
-    /*static*/ CEGUI::Rect QuestGUINode::getStaticTextArea(const CEGUI::Window* window)
-    {
-        const CEGUI::WidgetLookFeel& lookAndFeel = CEGUI::WidgetLookManager::getSingleton().getWidgetLook(window->getLookNFeel());
-
-        return lookAndFeel.getNamedArea("WithFrameTextRenderArea").getArea().getPixelRect(*window);
-    }
-
-    /**
-    @brief
-        Helper method to adjust the height of an input Window (of type StaticText) to the text it holds.
-    @param window
-        The  CEGUI Window (of type StaticText) for which the height is to be adjusted to the text.
-    @return
-        Returns the set height.
-    */
-    /*static*/ int QuestGUINode::setHeight(CEGUI::Window* window)
-    {
-        //! Get the area the text is formatted and drawn into.
-        const CEGUI::Rect formattedArea = getStaticTextArea(window);
-
-        //! Calculate the pixel height of the frame by subtracting the height of the area above from the total height of the window.
-        const float frameHeight = window->getUnclippedPixelRect().getHeight() - formattedArea.getHeight();
-
-        //! Get the formatted line count - using the formatting area obtained above.
-        const float lines = (float)(window->getFont()->getFormattedLineCount(window->getText(), formattedArea, CEGUI::WordWrapLeftAligned));
-
-        //! Calculate pixel height of window, which is the number of formatted lines multiplied by the spacing of the font, plus the pixel height of the frame.
-        const float height = lines * window->getFont()->getLineSpacing() + frameHeight;
-
-        //! Set the height to the window.
-        window->setHeight(CEGUI::UDim(0, height));
-
-        //Debug
-        const CEGUI::Rect newArea = getStaticTextArea(window);
-
-        return static_cast<int>(height);
-    }
-
-    /**
-    @brief
-        Update the position list item.
-    */
-    void QuestGUINode::updatePosition(void)
-    {
-        this->window_->setPosition(CEGUI::UVector2(CEGUI::UDim(0, (float)(QuestGUINode::INDENT_WIDTH*this->depth_)),CEGUI::UDim(0, (float)(QuestGUINode::BUTTON_HEIGHT*this->index_))));
-        this->window_->setSize(CEGUI::UVector2(CEGUI::UDim(1, (float)(-QuestGUINode::INDENT_WIDTH*this->depth_-QuestGUINode::SCROLLBAR_WIDTH)),CEGUI::UDim(0, (float)QuestGUINode::BUTTON_HEIGHT)));
-    }
-
-    /**
-    @brief
-        Helper method to create the CEGUI Window the node.
-    */
-    void QuestGUINode::createWindow(void)
-    {
-        Quest* quest = dynamic_cast<Quest*>(this->item_);
-
-        this->window_ = this->gui_->getWindow();
-        std::ostringstream stream;
-        stream << "QuestGUI/Quests/";
-        if(quest == NULL)
-        {
-            stream << this->parent_->index_ << "/Hints/";
-        }
-        stream << this->index_;
-
-        this->window_->rename(stream.str());
-        this->window_->setText(this->item_->getDescription()->getTitle());
-
-        this->parent_->subNodes_.push_back(this);
-
-        if(dynamic_cast<Quest*>(this->item_) != NULL)
-        {
-            this->gui_->getRootWindow()->addChildWindow(this->window_);
-            this->updatePosition();
-        }
-        else
-        {
-            this->window_->setDestroyedByParent(false);
-        }
-
-        this->window_->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&QuestGUINode::openDetails, this));
-    }
-
-}
-
Index: code/trunk/src/modules/questsystem/QuestGUINode.h
===================================================================
--- code/trunk/src/modules/questsystem/QuestGUINode.h	(revision 6906)
+++ 	(revision )
@@ -1,98 +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:
- *      Damian 'Mozork' Frick
- *   Co-authors:
- *      ...
- *
- */
-
-#ifndef _QuestGUINode_H__
-#define _QuestGUINode_H__
-
-#include "questsystem/QuestsystemPrereqs.h"
-
-#include <list>
-#include <string>
-#include <CEGUIForwardRefs.h>
-#include "core/OrxonoxClass.h"
-
-
-namespace orxonox {
-
-    class _QuestsystemExport QuestGUINode : public OrxonoxClass
-    {
-
-        public:
-
-            QuestGUINode(void);
-            QuestGUINode(QuestGUI* gui, QuestGUINode* parent, QuestItem* item, int depth, int index);
-            virtual ~QuestGUINode(void);
-
-            void toggleVisibility(void);
-
-            void getName(std::string & buffer); //!< Sets the input buffer to the name of the node.
-            /**
-            @brief Retreive the window of this node.
-            @return The CEGUI Window of this node.
-            */
-            inline CEGUI::Window* getWindow(void)
-                { return this->window_; }
-
-            bool openDetails(const CEGUI::EventArgs& e); //!< Opens the details window for the Quest/QuestHint clicked on.
-            bool closeDetails(const CEGUI::EventArgs& e); //!< Close the details window.
-
-        private:
-            CEGUI::Window* getDetails(void); //!< Creates the details window.
-
-            void initialize(void); //!< Initialize the object.
-            void updatePosition(void); //!< Update the position list item.
-            void createWindow(void); //!< Helper method to create the CEGUI Window the node.
-            static CEGUI::Rect getStaticTextArea(const CEGUI::Window* window); //Helper method for setHeight(). Gets the StaticTextArea for an input CEGUI Window.
-            static int setHeight(CEGUI::Window* window); //Helper method to adjust the height of an input Window (of type StaticText) to the text it holds.
-
-            bool visible_; //!< Boolean determining the visibility of the node.
-
-            QuestGUI* gui_; //!< The QuestGUI this node belongs to.
-            QuestGUINode* parent_; //!< The parent node.
-            std::list<QuestGUINode*> subNodes_; //!< A list of all subnodes.
-            QuestItem* item_; //!< QuestItem belonging to this node.
-
-            int depth_; //!< The depth (resp. indentation) of this node in the list of Quests. (Irrelevant for QuestHints)
-            int index_; //!< The index of this node in the list of Quests, resp. in the list of QuestHints, if the node belongs to a QuestHint, rather than a Quest.
-
-            CEGUI::Window* window_; //!< The list window of this node.
-            CEGUI::Window* details_; //!< The details window of this node.
-
-            //! Some magic numbers
-            static const int TITLE_HEIGHT = 26;
-            static const int BORDER_WIDTH = 5;
-            static const int SCROLLBAR_WIDTH = 13;
-            static const int BUTTON_HEIGHT = 30;
-            static const int INDENT_WIDTH = 20;
-
-    };
-
-}
-
-#endif /* _QuestGUINode_H__ */
-
Index: code/trunk/src/modules/questsystem/QuestHint.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestHint.cc	(revision 6906)
+++ code/trunk/src/modules/questsystem/QuestHint.cc	(revision 7163)
@@ -59,5 +59,6 @@
     QuestHint::~QuestHint()
     {
-
+        if(this->isRegistered())
+            QuestManager::getInstance().unregisterHint(this);
     }
 
@@ -72,5 +73,5 @@
         QuestManager::getInstance().registerHint(this); //!< Registers the QuestHint with the QuestManager.
 
-        COUT(3) << "New QuestHint {" << this->getId() << "} created." << std::endl;
+        COUT(4) << "New QuestHint {" << this->getId() << "} created." << std::endl;
     }
 
@@ -125,10 +126,10 @@
             else
             {
-                COUT(2) << "An already active questHint was trying to get activated." << std::endl;
+                COUT(4) << "An already active questHint was trying to get activated." << std::endl;
                 return false;
             }
         }
 
-        COUT(2) << "A hint of a non-active quest was trying to get activated." << std::endl;
+        COUT(4) << "A hint of a non-active quest was trying to get activated." << std::endl;
         return false;
     }
Index: code/trunk/src/modules/questsystem/QuestHint.h
===================================================================
--- code/trunk/src/modules/questsystem/QuestHint.h	(revision 6906)
+++ code/trunk/src/modules/questsystem/QuestHint.h	(revision 7163)
@@ -40,6 +40,6 @@
 #include "QuestItem.h"
 
-namespace orxonox
-{
+namespace orxonox // tolua_export
+{ // tolua_export
     namespace QuestHintStatus
     {
@@ -66,6 +66,7 @@
         Damian 'Mozork' Frick
     */
-    class _QuestsystemExport QuestHint : public QuestItem
-    {
+    class _QuestsystemExport QuestHint // tolua_export
+        : public QuestItem
+    { // tolua_export
 
         public:
@@ -91,7 +92,7 @@
             std::map<const PlayerInfo*, QuestHintStatus::Value> playerStatus_; //!< List of the states for each player, with the Player-pointer as key.
 
-    };
+    }; // tolua_export
 
-}
+} // tolua_export
 
 #endif /* _QuestHint_H__ */
Index: code/trunk/src/modules/questsystem/QuestItem.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestItem.cc	(revision 6906)
+++ code/trunk/src/modules/questsystem/QuestItem.cc	(revision 7163)
@@ -40,4 +40,7 @@
 namespace orxonox
 {
+
+    CreateUnloadableFactory(QuestItem);
+
     /**
     @brief
@@ -46,4 +49,6 @@
     QuestItem::QuestItem(BaseObject* creator) : BaseObject(creator)
     {
+        this->registered_ = false;
+
         RegisterObject(QuestItem);
     }
@@ -79,5 +84,5 @@
     void QuestItem::setId(const std::string & id)
     {
-        if(!isId(id)) //!< Checks whether the id is a valid id.
+        if(id.compare(BLANKSTRING) == 0) //!< Checks whether the id is a valid id.
         {
             COUT(2) << "Invalid id. QuestItem id {" << id << "} could not be set." << std::endl;
@@ -88,16 +93,3 @@
     }
 
-    /**
-    @brief
-        Checks whether an input id is of the required form.
-    @param id
-        The id to be checked.
-    @return
-        Returns true if the string is likely to be of the required form.
-    */
-    /*static*/ bool QuestItem::isId(const std::string & id)
-    {
-        return id.size() >= 32;
-    }
-
 }
Index: code/trunk/src/modules/questsystem/QuestItem.h
===================================================================
--- code/trunk/src/modules/questsystem/QuestItem.h	(revision 6906)
+++ code/trunk/src/modules/questsystem/QuestItem.h	(revision 7163)
@@ -41,4 +41,5 @@
 #include <string>
 #include "core/BaseObject.h"
+#include "QuestManager.h"
 
 namespace orxonox
@@ -71,8 +72,18 @@
             @return Returns a pointer to the QuestDescription object of the QuestItem.
             */
-            inline const QuestDescription* getDescription(void) const
+            inline QuestDescription* getDescription(void) const
                 { return this->description_; }
 
-            static bool isId(const std::string & id); //!< Checks whether a given id is valid.
+            /**
+            @brief Check whether the QuestItem is registered with the QuestManager.
+            @return Returns true if the QuestItem is registered with the QuestManager.
+            */
+            inline bool isRegistered(void)
+                { return this->registered_; }
+            /**
+            @brief Set the QuestItem as being registered with the QuestManager.
+            */
+            inline void setRegistered(void)
+                { this->registered_ = true; }
 
         protected:
@@ -90,4 +101,6 @@
             QuestDescription* description_; //!< The QuestDescription of the QuestItem.
 
+            bool registered_;
+
     };
 
Index: code/trunk/src/modules/questsystem/QuestListener.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestListener.cc	(revision 6906)
+++ code/trunk/src/modules/questsystem/QuestListener.cc	(revision 7163)
@@ -74,7 +74,8 @@
         XMLPortParam(QuestListener, "mode", setMode, getMode, xmlelement, mode);
 
-        this->quest_->addListener(this); //!< Adds the QuestListener to the Quests list of listeners.
-
-        COUT(3) << "QuestListener created for quest: {" << this->quest_->getId() << "} with mode '" << this->getMode() << "'." << std::endl;
+        if(this->quest_ != NULL)
+            this->quest_->addListener(this); //!< Adds the QuestListener to the Quests list of listeners.
+
+        COUT(4) << "QuestListener created for quest: {" << this->quest_->getId() << "} with mode '" << this->getMode() << "'." << std::endl;
     }
 
Index: code/trunk/src/modules/questsystem/QuestManager.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestManager.cc	(revision 6906)
+++ code/trunk/src/modules/questsystem/QuestManager.cc	(revision 7163)
@@ -74,9 +74,5 @@
     QuestManager::~QuestManager()
     {
-        for(std::map<PlayerInfo*, QuestGUI*>::iterator it = this->questGUIs_.begin(); it != this->questGUIs_.end(); it++)
-        {
-            it->second->destroy();
-        }
-        this->questGUIs_.clear();
+
     }
 
@@ -114,5 +110,6 @@
         if(result.second) //!< If inserting was a success.
         {
-            COUT(3) << "Quest with questId {" << quest->getId() << "} successfully inserted." << std::endl;
+            quest->setRegistered();
+            COUT(4) << "Quest with questId {" << quest->getId() << "} successfully inserted." << std::endl;
             return true;
         }
@@ -122,4 +119,13 @@
            return false;
         }
+    }
+
+    /**
+    @brief
+        Unregisters a Quest in the QuestManager.
+    */
+    bool QuestManager::unregisterQuest(Quest* quest)
+    {
+        return this->questMap_.erase(quest->getId()) == 1;
     }
 
@@ -146,5 +152,6 @@
         if(result.second) //!< If inserting was a success.
         {
-            COUT(3) << "QuestHint with hintId {" << hint->getId() << "} successfully inserted." << std::endl;
+            hint->setRegistered();
+            COUT(4) << "QuestHint with hintId {" << hint->getId() << "} successfully inserted." << std::endl;
             return true;
         }
@@ -154,4 +161,13 @@
            return false;
         }
+    }
+
+    /**
+    @brief
+        Unregisters a QuestHint in the QuestManager.
+    */
+    bool QuestManager::unregisterHint(QuestHint* hint)
+    {
+        return this->hintMap_.erase(hint->getId()) == 1;
     }
 
@@ -169,5 +185,5 @@
     Quest* QuestManager::findQuest(const std::string & questId)
     {
-        if(!QuestItem::isId(questId)) //!< Check vor validity of the given id.
+        if(questId.compare(BLANKSTRING) == 1) //!< Check vor validity of the given id.
         {
             ThrowException(Argument, "Invalid questId.");
@@ -203,5 +219,5 @@
     QuestHint* QuestManager::findHint(const std::string & hintId)
     {
-        if(!QuestItem::isId(hintId)) //!< Check vor validity of the given id.
+        if(hintId.compare(BLANKSTRING) == 1) //!< Check vor validity of the given id.
         {
             ThrowException(Argument, "Invalid hintId.");
@@ -224,21 +240,79 @@
     }
 
-    /**
-    @brief
-        Retreive the main window for the GUI.
-        This is for the use in the lua script tu start the QuestGUI.
-    @param guiName
-        The name of the GUI.
-    @return
-        Returns a CEGUI Window.
-    */
-    CEGUI::Window* QuestManager::getQuestGUI(const std::string & guiName)
-    {
-        PlayerInfo* player = this->retrievePlayer(guiName);
-
-        if(this->questGUIs_.find(player) == this->questGUIs_.end()) //!< Create a new GUI, if there is none, yet.
-            this->questGUIs_[player] = new QuestGUI(player);
-
-        return this->questGUIs_[player]->getGUI();
+    int QuestManager::getNumParentQuests(PlayerInfo* player)
+    {
+        int numQuests = 0;
+        for(std::map<std::string, Quest*>::iterator it = this->questMap_.begin(); it != this->questMap_.end(); it++)
+        {
+            if(it->second->getParentQuest() == NULL && !it->second->isInactive(player))
+                numQuests++;
+        }
+        return numQuests;
+    }
+
+    Quest* QuestManager::getParentQuest(PlayerInfo* player, int index)
+    {
+        for(std::map<std::string, Quest*>::iterator it = this->questMap_.begin(); it != this->questMap_.end(); it++)
+        {
+            if(it->second->getParentQuest() == NULL && !it->second->isInactive(player) && index-- == 0)
+                return it->second;
+        }
+        return NULL;
+    }
+
+    int QuestManager::getNumSubQuests(Quest* quest, PlayerInfo* player)
+    {
+        std::list<Quest*> quests = quest->getSubQuestList();
+        int numQuests = 0;
+        for(std::list<Quest*>::iterator it = quests.begin(); it != quests.end(); it++)
+        {
+            if(!(*it)->isInactive(player))
+                numQuests++;
+        }
+        return numQuests;
+    }
+
+    Quest* QuestManager::getSubQuest(Quest* quest, PlayerInfo* player, int index)
+    {
+        std::list<Quest*> quests = quest->getSubQuestList();
+        for(std::list<Quest*>::iterator it = quests.begin(); it != quests.end(); it++)
+        {
+            if(!(*it)->isInactive(player) && index-- == 0)
+                return *it;
+        }
+        return NULL;
+    }
+
+    int QuestManager::getNumHints(Quest* quest, PlayerInfo* player)
+    {
+        std::list<QuestHint*> hints = quest->getHintsList();
+        int numHints = 0;
+        for(std::list<QuestHint*>::iterator it = hints.begin(); it != hints.end(); it++)
+        {
+            if((*it)->isActive(player))
+                numHints++;
+        }
+        return numHints;
+    }
+
+    QuestHint* QuestManager::getHints(Quest* quest, PlayerInfo* player, int index)
+    {
+        std::list<QuestHint*> hints = quest->getHintsList();
+        for(std::list<QuestHint*>::iterator it = hints.begin(); it != hints.end(); it++)
+        {
+            if((*it)->isActive(player) && index-- == 0)
+                return *it;
+        }
+        return NULL;
+    }
+
+    QuestDescription* QuestManager::getDescription(Quest* item)
+    {
+        return item->getDescription();
+    }
+
+    QuestDescription* QuestManager::getDescription(QuestHint* item)
+    {
+        return item->getDescription();
     }
 
Index: code/trunk/src/modules/questsystem/QuestManager.h
===================================================================
--- code/trunk/src/modules/questsystem/QuestManager.h	(revision 6906)
+++ code/trunk/src/modules/questsystem/QuestManager.h	(revision 7163)
@@ -36,5 +36,4 @@
 
 #include "questsystem/QuestsystemPrereqs.h"
-#include <CEGUIForwardRefs.h>
 
 #include <list>
@@ -44,6 +43,4 @@
 #include "util/Singleton.h"
 #include "core/OrxonoxClass.h"
-
-#include "QuestGUI.h"
 
 // tolua_begin
@@ -63,5 +60,4 @@
 
             friend class Singleton<QuestManager>;
-            friend class QuestGUI;
 
         public:
@@ -72,9 +68,22 @@
             static QuestManager& getInstance() { return Singleton<QuestManager>::getInstance(); } // tolua_export
 
-            //! Retrieve the main window for the GUI.
-            CEGUI::Window* getQuestGUI(const std::string & guiName); // tolua_export
+            // tolua_begin
+            int getNumParentQuests(orxonox::PlayerInfo* player);
+            Quest* getParentQuest(orxonox::PlayerInfo* player, int index);
+
+            int getNumSubQuests(Quest* quest, orxonox::PlayerInfo* player);
+            Quest* getSubQuest(Quest* quest, orxonox::PlayerInfo* player, int index);
+
+            int getNumHints(Quest* quest, orxonox::PlayerInfo* player);
+            QuestHint* getHints(Quest* quest, orxonox::PlayerInfo* player, int index);
+
+            QuestDescription* getDescription(Quest* item);
+            QuestDescription* getDescription(QuestHint* item);
+            // tolua_end
 
             bool registerQuest(Quest* quest); //!< Registers a Quest in the QuestManager.
-            bool registerHint(QuestHint* quest); //!< Registers a QuestHint in the QuestManager.
+            bool unregisterQuest(Quest* quest); //!< Unregisters a Quest in the QuestManager.
+            bool registerHint(QuestHint* hint); //!< Registers a QuestHint in the QuestManager.
+            bool unregisterHint(QuestHint* hint); //!< Unregisters a QuestHint in the QuestManager.
 
             Quest* findQuest(const std::string & questId); //!< Returns the Quest with the input id.
@@ -91,6 +100,4 @@
             std::map<std::string, QuestHint*> hintMap_; //!< All QuestHints registered by their id's.
 
-            std::map<PlayerInfo*, QuestGUI*> questGUIs_; //!< All GUI's registered by the players.
-
     }; // tolua_export
 
Index: code/trunk/src/modules/questsystem/QuestNotification.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestNotification.cc	(revision 6906)
+++ code/trunk/src/modules/questsystem/QuestNotification.cc	(revision 7163)
@@ -32,16 +32,32 @@
 namespace orxonox {
 
-    const std::string QuestNotification::SENDER("questsystem");
+    /*static*/ const std::string QuestNotification::SENDER("questsystem");
 
+    CreateUnloadableFactory(QuestNotification);
+
+    /**
+    @brief
+        Default Constructor. Creates a useless QuestNotification.
+    */
     QuestNotification::QuestNotification(BaseObject* creator) : Notification(creator)
     {
-        this->initialize();
+        RegisterObject(QuestNotification);
     }
 
-    QuestNotification::QuestNotification(const std::string & message) : Notification(message)
+    /**
+    @brief
+        Creates a QuestNotification with the input message.
+    @param message
+        The message to be sent.
+    */
+    QuestNotification::QuestNotification(BaseObject* creator, const std::string & message) : Notification(creator, message)
     {
-        this->initialize();
+        RegisterObject(QuestNotification);
     }
 
+    /**
+    @brief
+        Destructor.
+    */
     QuestNotification::~QuestNotification()
     {
@@ -49,4 +65,10 @@
     }
 
+    /**
+    @brief
+        Send the QuestNotification.
+    @return
+        Returns true if successful.
+    */
     bool QuestNotification::send(void)
     {
@@ -54,9 +76,4 @@
     }
 
-    void QuestNotification::initialize(void)
-    {
-        RegisterObject(QuestNotification);
-    }
-
 
 }
Index: code/trunk/src/modules/questsystem/QuestNotification.h
===================================================================
--- code/trunk/src/modules/questsystem/QuestNotification.h	(revision 6906)
+++ code/trunk/src/modules/questsystem/QuestNotification.h	(revision 7163)
@@ -39,5 +39,5 @@
     /**
     @brief
-
+        The QuestNotification is a special Notification that has the single property that it is only sent by the questsystem.
     @author
         Damian 'Mozork' Frick
@@ -46,14 +46,12 @@
     {
         public:
-            QuestNotification(BaseObject* creator);
-            QuestNotification(const std::string & message);
-            virtual ~QuestNotification();
+            QuestNotification(BaseObject* creator); //!< Default Constructor.
+            QuestNotification(BaseObject* creator, const std::string & message); //!< Constructor.
+            virtual ~QuestNotification(); //!< Destructor.
 
-            bool send(void);
+            bool send(void); //!< Send the QuestNotification.
 
         private:
-            static const std::string SENDER;
-
-            void initialize(void);
+            static const std::string SENDER; //!< A string identifying the questsystem as the sender.
 
     };
Index: code/trunk/src/modules/questsystem/QuestsystemPrereqs.h
===================================================================
--- code/trunk/src/modules/questsystem/QuestsystemPrereqs.h	(revision 6906)
+++ code/trunk/src/modules/questsystem/QuestsystemPrereqs.h	(revision 7163)
@@ -43,5 +43,5 @@
 //-----------------------------------------------------------------------
 
-#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(ORXONOX_STATIC_BUILD)
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(QUESTSYSTEM_STATIC_BUILD)
 #  ifdef QUESTSYSTEM_SHARED_BUILD
 #    define _QuestsystemExport __declspec(dllexport)
@@ -77,6 +77,4 @@
     class QuestEffect;
     class QuestEffectBeacon;
-    class QuestGUI;
-    class QuestGUINode;
     class QuestHint;
     class QuestItem;
Index: code/trunk/src/modules/questsystem/notifications/Notification.cc
===================================================================
--- code/trunk/src/modules/questsystem/notifications/Notification.cc	(revision 6906)
+++ code/trunk/src/modules/questsystem/notifications/Notification.cc	(revision 7163)
@@ -40,4 +40,6 @@
 {
 
+    CreateUnloadableFactory(Notification);
+
     /**
     @brief
@@ -56,5 +58,5 @@
         The message of the Notification.
     */
-    Notification::Notification(const std::string & message) : BaseObject(NULL)
+    Notification::Notification(BaseObject* creator, const std::string & message) : BaseObject(creator)
     {
         this->message_ = message;
@@ -67,4 +69,5 @@
     Notification::~Notification()
     {
+
     }
 
Index: code/trunk/src/modules/questsystem/notifications/Notification.h
===================================================================
--- code/trunk/src/modules/questsystem/notifications/Notification.h	(revision 6906)
+++ code/trunk/src/modules/questsystem/notifications/Notification.h	(revision 7163)
@@ -53,5 +53,5 @@
         public:
             Notification(BaseObject* creator);
-            Notification(const std::string & message);
+            Notification(BaseObject* creator, const std::string & message);
             virtual ~Notification();
 
Index: code/trunk/src/modules/questsystem/notifications/NotificationManager.cc
===================================================================
--- code/trunk/src/modules/questsystem/notifications/NotificationManager.cc	(revision 6906)
+++ code/trunk/src/modules/questsystem/notifications/NotificationManager.cc	(revision 7163)
@@ -66,4 +66,5 @@
     NotificationManager::~NotificationManager()
     {
+
     }
 
@@ -101,10 +102,68 @@
                 this->notificationLists_[it->second]->insert(std::pair<std::time_t,Notification*>(time,notification)); //!< Insert the Notification in the Notifications list of the current NotificationListener.
                 it->first->update(notification, time); //!< Update the listener.
+                std::map<Notification*, unsigned int>::iterator counterIt = this->listenerCounter_.find(notification);
+                if(counterIt == this->listenerCounter_.end())
+                    this->listenerCounter_[notification] = 1;
+                else
+                    this->listenerCounter_[notification] = counterIt->second + 1;
             }
         }
 
-        COUT(3) << "Notification registered with the NotificationManager." << std::endl;
+        COUT(4) << "Notification registered with the NotificationManager." << std::endl;
 
         return true;
+    }
+
+    /**
+    @brief
+        Unregisters a Notification within the NotificationManager.
+    @param notification
+        A pointer to the Notification to be unregistered.
+    @param listener
+        A pointer to the NotificationListener the Notification is unregistered for.
+    */
+    void NotificationManager::unregisterNotification(Notification* notification, NotificationListener* listener)
+    {
+        assert(notification);
+        assert(listener);
+
+        // If the Notification was removed from the list of Notifications of the input NotificationListener, the counter for the Notification of the number of NotificationListeners it is present in is decremented.
+        if(this->removeNotification(notification, *(this->notificationLists_.find(this->listenerList_.find(listener)->second)->second)))
+            this->listenerCounter_[notification] = this->listenerCounter_[notification] - 1;
+
+        // If the Notification is no longer present in any of the NotificationListeners it can be removed from the map of all Notifications and be destroyed.
+        if(this->listenerCounter_[notification] == (unsigned int) 0)
+        {
+            this->removeNotification(notification, this->allNotificationsList_);
+            this->listenerCounter_.erase(notification);
+            notification->destroy();
+        }
+
+        COUT(4) << "Notification unregistered with the NotificationManager." << std::endl;
+    }
+
+    /**
+    @brief
+        Helper method that removes an input notification form an input map.
+    @param notification
+        A pointer to the notification to be removed.
+    @param map
+        The map the notification should be removed from.
+    @return
+        Returns true if successful.
+    */
+    bool NotificationManager::removeNotification(Notification* notification, std::multimap<std::time_t, Notification*>& map)
+    {
+        // Iterates through all items in the map until the Notification is found.
+        //TODO: Do more efficiently?
+        for(std::multimap<std::time_t, Notification*>::iterator it = map.begin(); it != map.end(); it++)
+        {
+            if(it->second == notification)
+            {
+                map.erase(it);
+                return true;
+            }
+        }
+        return false;
     }
 
@@ -130,5 +189,5 @@
         {
             this->notificationLists_[index] = &this->allNotificationsList_;
-            COUT(3) << "NotificationListener registered with the NotificationManager." << std::endl;
+            COUT(4) << "NotificationListener registered with the NotificationManager." << std::endl;
             return true;
         }
@@ -142,5 +201,10 @@
             if(set.find(it->second->getSender()) != set.end()) //!< Checks whether the overlay has the sender of the current notification as target.
             {
-                map.insert(std::pair<std::time_t,Notification*>(it->first, it->second));
+                map.insert(std::pair<std::time_t, Notification*>(it->first, it->second));
+                std::map<Notification*, unsigned int>::iterator counterIt = this->listenerCounter_.find(it->second);
+                if(counterIt == this->listenerCounter_.end())
+                    this->listenerCounter_[it->second] = 1;
+                else
+                    this->listenerCounter_[it->second] = counterIt->second + 1;
             }
         }
@@ -148,7 +212,36 @@
         listener->update(); //!< Update the listener.
 
-        COUT(3) << "NotificationListener registered with the NotificationManager." << std::endl;
+        COUT(4) << "NotificationListener registered with the NotificationManager." << std::endl;
 
         return true;
+    }
+
+    /**
+    @brief
+        Unregisters a NotificationListener withing the NotificationManager.
+    */
+    void NotificationManager::unregisterListener(NotificationListener* listener)
+    {
+        assert(listener);
+
+        int identifier = this->listenerList_.find(listener)->second;
+        std::multimap<std::time_t, Notification*>* map = this->notificationLists_.find(identifier)->second;
+
+        // Make sure all Notifications are removed.
+        std::multimap<std::time_t, Notification*>::iterator it = map->begin();
+        while(it != map->end())
+        {
+            this->unregisterNotification(it->second, listener);
+            it = map->begin();
+        }
+
+        this->listenerList_.erase(listener);
+        this->notificationLists_.erase(identifier);
+
+        // If the map is not the map of all notifications, delete it.
+        if(map != &this->allNotificationsList_)
+            delete map;
+
+        COUT(4) << "NotificationListener unregistered with the NotificationManager." << std::endl;
     }
 
Index: code/trunk/src/modules/questsystem/notifications/NotificationManager.h
===================================================================
--- code/trunk/src/modules/questsystem/notifications/NotificationManager.h	(revision 6906)
+++ code/trunk/src/modules/questsystem/notifications/NotificationManager.h	(revision 7163)
@@ -60,9 +60,11 @@
             virtual ~NotificationManager();
 
-            static const std::string ALL;
-            static const std::string NONE;
+            static const std::string ALL; //!< Static string to indicate a sender that sends to all NotificationListeners.
+            static const std::string NONE; //!< Static string to indicare a sender that sends to no specific NotificationListener.
 
             bool registerNotification(Notification* notification); //!< Registers a Notification within the NotificationManager.
+            void unregisterNotification(Notification* notification, NotificationListener* listener); //!< Unregisters a Notification within the NotificationManager.
             bool registerListener(NotificationListener* listener); //!< Registers a NotificationListener within the NotificationManager.
+            void unregisterListener(NotificationListener* listener); //!< Unregisters a NotificationListener withing the NotificationManager.
 
             bool getNotifications(NotificationListener* listener, std::multimap<std::time_t,Notification*>* map, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd); //!< Returns the Notifications for a specific NotificationListener in a specified timeframe.
@@ -90,10 +92,12 @@
             static NotificationManager* singletonPtr_s;
 
-            int highestIndex_; //!< This variable holds the highest index (resp. key) in notificationLists_s, to secure that  no key appears twice.
+            int highestIndex_; //!< This variable holds the highest index (resp. key) in notificationLists_s, to secure that no key appears twice.
 
-            std::multimap<std::time_t,Notification*> allNotificationsList_; //!< Container where all notifications are stored (together with their respecive timestamps).
+            std::multimap<std::time_t,Notification*> allNotificationsList_; //!< Container where all notifications are stored.
             std::map<NotificationListener*,int> listenerList_; //!< Container where all NotificationListeners are stored with a number as identifier.
             std::map<int,std::multimap<std::time_t,Notification*>*> notificationLists_; //!< Container where all Notifications, for each identifier (associated with a NotificationListener), are stored.
+            std::map<Notification*, unsigned int> listenerCounter_; //!< A container to store the number of NotificationListeners a Notification is registered with.
 
+            bool removeNotification(Notification* notification, std::multimap<std::time_t, Notification*>& map); //!< Helper method that removes an input notification form an input map.
 
     };
Index: code/trunk/src/modules/questsystem/notifications/NotificationQueue.cc
===================================================================
--- code/trunk/src/modules/questsystem/notifications/NotificationQueue.cc	(revision 6906)
+++ code/trunk/src/modules/questsystem/notifications/NotificationQueue.cc	(revision 7163)
@@ -34,6 +34,5 @@
 #include "NotificationQueue.h"
 
-#include <sstream>
-
+#include "util/Convert.h"
 #include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
@@ -56,4 +55,6 @@
     NotificationQueue::NotificationQueue(BaseObject* creator) : OverlayGroup(creator)
     {
+        this->registered_ = false;
+
         RegisterObject(NotificationQueue);
         this->initialize();
@@ -68,4 +69,7 @@
         this->targets_.clear();
         this->clear();
+
+        if(this->registered_)
+            NotificationManager::getInstance().unregisterListener(this);
     }
 
@@ -81,4 +85,5 @@
 
         NotificationManager::getInstance().registerListener(this);
+        this->registered_ = true;
     }
 
@@ -118,5 +123,5 @@
         XMLPortParam(NotificationQueue, "position", setPosition, getPosition, xmlElement, mode);
 
-        COUT(3) << "NotificationQueue created." << std::endl;
+        COUT(3) << "NotificationQueue '" << this->getName() << "' created." << std::endl;
     }
 
@@ -173,5 +178,5 @@
         delete notifications;
 
-        COUT(3) << "NotificationQueue updated." << std::endl;
+        COUT(4) << "NotificationQueue '" << this->getName() << "' updated." << std::endl;
     }
 
@@ -196,5 +201,5 @@
         }
 
-        COUT(3) << "NotificationQueue updated. A new Notifications has been added." << std::endl;
+        COUT(4) << "NotificationQueue '" << this->getName() << "' updated. A new Notifications has been added." << std::endl;
     }
 
@@ -397,7 +402,5 @@
         std::string timeString = std::ctime(&time);
         timeString.erase(timeString.length()-1);
-        std::ostringstream stream;
-        stream << reinterpret_cast<unsigned long>(notification);
-        const std::string& addressString = stream.str();
+        const std::string& addressString = multi_cast<std::string>(reinterpret_cast<unsigned long>(notification));
         container->name = "NotificationOverlay(" + timeString + ")&" + addressString;
 
@@ -422,4 +425,7 @@
         if(this->size_ == 0) //!< You cannot remove anything if the queue is empty.
             return false;
+
+        // Unregister the NotificationQueue with the NotificationManager.
+        NotificationManager::getInstance().unregisterNotification(container->notification, this);
 
         this->removeElement(container->overlay);
@@ -443,5 +449,5 @@
         {
             this->removeContainer(*it);
-            it = this->containers_.begin(); //TODO: Needed?
+            it = this->containers_.begin();
         }
     }
Index: code/trunk/src/modules/questsystem/notifications/NotificationQueue.h
===================================================================
--- code/trunk/src/modules/questsystem/notifications/NotificationQueue.h	(revision 6906)
+++ code/trunk/src/modules/questsystem/notifications/NotificationQueue.h	(revision 7163)
@@ -71,4 +71,5 @@
 
         Creating a NotificationQueue through XML goes as follows:
+        Be aware that the NotificationQueue must be inside the <Level></Level> tags or bad things will happen.
         <NotificationQueue
             name = "SuperQueue" //Name of your OverlayQueue.
@@ -185,4 +186,6 @@
             NotificationOverlayContainer timeLimit_; //!< Helper object to check against to determine whether Notifications have expired.
 
+            bool registered_; //!< Helper variable to remember whether the NotificationQueue is registered already.
+
             void initialize(void); //!< Initializes the object.
             void setDefaults(void); //!< Helper method to set the default values.
