[Orxonox-commit 925] r5648 - in code/branches/libraries/src: core orxonox orxonox/gamestates orxonox/objects/quest orxonox/objects/quest/notifications orxonox/overlays

landauf at orxonox.net landauf at orxonox.net
Fri Aug 14 03:07:59 CEST 2009


Author: landauf
Date: 2009-08-14 03:07:59 +0200 (Fri, 14 Aug 2009)
New Revision: 5648

Added:
   code/branches/libraries/src/orxonox/objects/quest/QuestPrereqs.h
   code/branches/libraries/src/orxonox/objects/quest/notifications/NotificationOverlay.cc
   code/branches/libraries/src/orxonox/objects/quest/notifications/NotificationOverlay.h
   code/branches/libraries/src/orxonox/objects/quest/notifications/NotificationQueue.cc
   code/branches/libraries/src/orxonox/objects/quest/notifications/NotificationQueue.h
Removed:
   code/branches/libraries/src/orxonox/overlays/notifications/
Modified:
   code/branches/libraries/src/core/GUIManager.h
   code/branches/libraries/src/orxonox/CMakeLists.txt
   code/branches/libraries/src/orxonox/OrxonoxPrereqs.h
   code/branches/libraries/src/orxonox/gamestates/GSLevel.cc
   code/branches/libraries/src/orxonox/gamestates/GSLevel.h
   code/branches/libraries/src/orxonox/objects/quest/AddQuest.h
   code/branches/libraries/src/orxonox/objects/quest/AddQuestHint.h
   code/branches/libraries/src/orxonox/objects/quest/AddReward.h
   code/branches/libraries/src/orxonox/objects/quest/CMakeLists.txt
   code/branches/libraries/src/orxonox/objects/quest/ChangeQuestStatus.h
   code/branches/libraries/src/orxonox/objects/quest/CompleteQuest.h
   code/branches/libraries/src/orxonox/objects/quest/FailQuest.h
   code/branches/libraries/src/orxonox/objects/quest/GlobalQuest.h
   code/branches/libraries/src/orxonox/objects/quest/LocalQuest.h
   code/branches/libraries/src/orxonox/objects/quest/Quest.h
   code/branches/libraries/src/orxonox/objects/quest/QuestDescription.h
   code/branches/libraries/src/orxonox/objects/quest/QuestEffect.h
   code/branches/libraries/src/orxonox/objects/quest/QuestEffectBeacon.h
   code/branches/libraries/src/orxonox/objects/quest/QuestHint.h
   code/branches/libraries/src/orxonox/objects/quest/QuestItem.h
   code/branches/libraries/src/orxonox/objects/quest/QuestListener.h
   code/branches/libraries/src/orxonox/objects/quest/QuestManager.cc
   code/branches/libraries/src/orxonox/objects/quest/QuestManager.h
   code/branches/libraries/src/orxonox/objects/quest/QuestNotification.h
   code/branches/libraries/src/orxonox/objects/quest/notifications/CMakeLists.txt
   code/branches/libraries/src/orxonox/objects/quest/notifications/Notification.h
   code/branches/libraries/src/orxonox/objects/quest/notifications/NotificationManager.h
   code/branches/libraries/src/orxonox/overlays/CMakeLists.txt
   code/branches/libraries/src/orxonox/overlays/GUIOverlay.cc
   code/branches/libraries/src/orxonox/overlays/OverlaysPrereqs.h
Log:
sorry, large commit, but all changes are dependent:

 - Created a new plugin for the questsystem (called just "quest" for the moment because I'd had to rename the directory otherwise (the tolua script enforces this))
 - Added QuestPrereqs.h file and _QuestExport macro
 - Moved the GUI-name <-> PlayerInfo map from QuestManager to GUIManager
 - Moved NotificationOverlay and NotificationQueue from overlays to quest and linked the overlays plugin into the quest plugin
 - Made QuestManager and NotificationManager ScopedSingletons with ScopeID GSLevel. Also removed both singletons from GSLevel and added the Scope instance instead.

Modified: code/branches/libraries/src/core/GUIManager.h
===================================================================
--- code/branches/libraries/src/core/GUIManager.h	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/core/GUIManager.h	2009-08-14 01:07:59 UTC (rev 5648)
@@ -49,6 +49,8 @@
 
 namespace orxonox
 {
+    class PlayerInfo; // Forward declaration
+
     /**
     @class GUIManager
     @brief
@@ -76,6 +78,11 @@
 
         static GUIManager* getInstancePtr() { return singletonPtr_s; }
 
+        inline void setPlayer(const std::string& guiname, PlayerInfo* player)
+            { this->players_[guiname] = player; }
+        inline PlayerInfo* getPlayer(const std::string& guiname) const
+            { std::map<std::string, PlayerInfo*>::const_iterator it = this->players_.find(guiname); return (it != this->players_.end()) ? it->second : 0; }
+
     private:
         GUIManager(const GUIManager& instance); //!< private and undefined copy c'tor (this is a singleton class)
 
@@ -91,15 +98,16 @@
         void mouseMoved    (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize);
         void mouseScrolled (int abs, int rel);
 
-        boost::scoped_ptr<CEGUI::OgreCEGUIRenderer> guiRenderer_;  //!< CEGUI's interface to the Ogre Engine
-        boost::scoped_ptr<CEGUI::LuaScriptModule>   scriptModule_; //!< CEGUI's script module to use Lua
-        boost::scoped_ptr<CEGUI::System>            guiSystem_;    //!< CEGUI's main system
-        Ogre::RenderWindow*      renderWindow_;     //!< Ogre's render window to give CEGUI access to it
-        CEGUI::ResourceProvider* resourceProvider_; //!< CEGUI's resource provider
-        CEGUI::Logger*           ceguiLogger_;      //!< CEGUI's logger to be able to log CEGUI errors in our log
-        lua_State*               luaState_;         //!< Lua state, access point to the Lua engine
+        boost::scoped_ptr<CEGUI::OgreCEGUIRenderer> guiRenderer_;       //!< CEGUI's interface to the Ogre Engine
+        boost::scoped_ptr<CEGUI::LuaScriptModule>   scriptModule_;      //!< CEGUI's script module to use Lua
+        boost::scoped_ptr<CEGUI::System>            guiSystem_;         //!< CEGUI's main system
+        Ogre::RenderWindow*                         renderWindow_;      //!< Ogre's render window to give CEGUI access to it
+        CEGUI::ResourceProvider*                    resourceProvider_;  //!< CEGUI's resource provider
+        CEGUI::Logger*                              ceguiLogger_;       //!< CEGUI's logger to be able to log CEGUI errors in our log
+        lua_State*                                  luaState_;          //!< Lua state, access point to the Lua engine
+        std::map<std::string, PlayerInfo*>          players_;           //!< Stores the player (owner) for each gui
 
-        static GUIManager*       singletonPtr_s;    //!< Singleton reference to GUIManager
+        static GUIManager*                          singletonPtr_s;     //!< Singleton reference to GUIManager
 
     };
 }

Modified: code/branches/libraries/src/orxonox/CMakeLists.txt
===================================================================
--- code/branches/libraries/src/orxonox/CMakeLists.txt	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/CMakeLists.txt	2009-08-14 01:07:59 UTC (rev 5648)
@@ -46,8 +46,6 @@
     LevelManager.h
     objects/pickup/BaseItem.h
     objects/pickup/PickupInventory.h
-    objects/quest/QuestDescription.h
-    objects/quest/QuestManager.h
   DEFINE_SYMBOL
     "ORXONOX_SHARED_BUILD"
   PCH_FILE

Modified: code/branches/libraries/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- code/branches/libraries/src/orxonox/OrxonoxPrereqs.h	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/OrxonoxPrereqs.h	2009-08-14 01:07:59 UTC (rev 5648)
@@ -79,25 +79,6 @@
     class Scene;
     class Tickable;
 
-    class AddQuest;
-    class AddQuestHint;
-    class AddReward;
-    class ChangeQuestStatus;
-    class CompleteQuest;
-    class FailQuest;
-    class GlobalQuest;
-    class LocalQuest;
-    class Quest;
-    class QuestDescription;
-    class QuestEffect;
-    class QuestEffectBeacon;
-    class QuestHint;
-    class QuestItem;
-    class QuestListener;
-    class QuestManager;
-    class QuestNotification;
-    class Rewardable;
-
     class WorldEntity;
     class StaticEntity;
     class MobileEntity;

Modified: code/branches/libraries/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- code/branches/libraries/src/orxonox/gamestates/GSLevel.cc	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/gamestates/GSLevel.cc	2009-08-14 01:07:59 UTC (rev 5648)
@@ -46,8 +46,6 @@
 
 #include "tools/interfaces/Tickable.h"
 #include "objects/Radar.h"
-#include "objects/quest/QuestManager.h"
-#include "objects/quest/notifications/NotificationManager.h"
 #include "CameraManager.h"
 #include "LevelManager.h"
 #include "PlayerManager.h"
@@ -109,10 +107,8 @@
 
         this->playerManager_ = new PlayerManager();
 
-        this->questManager_ = new QuestManager();
+        this->scope_GSLevel_ = new Scope<ScopeID::GSLevel>();
 
-        this->notificationManager_ = new NotificationManager();
-
         if (GameMode::isMaster())
         {
             this->loadLevel();
@@ -200,18 +196,12 @@
             this->playerManager_ = 0;
         }
 
-        if (this->questManager_)
+        if (this->scope_GSLevel_)
         {
-            delete this->questManager_;
-            this->questManager_ = NULL;
+            delete this->scope_GSLevel_;
+            this->scope_GSLevel_ = NULL;
         }
 
-        if (this->notificationManager_)
-        {
-            delete this->notificationManager_;
-            this->notificationManager_ = NULL;
-        }
-
         if (GameMode::showsGraphics())
         {
             gameInputState_->setHandler(0);

Modified: code/branches/libraries/src/orxonox/gamestates/GSLevel.h
===================================================================
--- code/branches/libraries/src/orxonox/gamestates/GSLevel.h	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/gamestates/GSLevel.h	2009-08-14 01:07:59 UTC (rev 5648)
@@ -32,6 +32,7 @@
 #include "gamestates/GameStatesPrereqs.h"
 
 #include <string>
+#include "util/Scope.h"
 #include "core/OrxonoxClass.h"
 #include "core/GameState.h"
 
@@ -61,15 +62,14 @@
         void tkeybind(const std::string& command);
         void keybindInternal(const std::string& command, bool bTemporary);
 
-        KeyBinder*            keyBinder_;               //!< tool that loads and manages the input bindings
-        InputState*           gameInputState_;          //!< input state for normal ingame playing
-        InputState*           guiMouseOnlyInputState_;  //!< input state if we only need the mouse to use the GUI
-        InputState*           guiKeysOnlyInputState_;   //!< input state if we only need the keys to use the GUI
-        Radar*                radar_;                   //!< represents the Radar (not the HUD part)
-        CameraManager*        cameraManager_;           //!< camera manager for this level
-        PlayerManager*        playerManager_;           //!< player manager for this level
-        QuestManager*         questManager_;
-        NotificationManager*  notificationManager_;
+        KeyBinder*               keyBinder_;               //!< tool that loads and manages the input bindings
+        InputState*              gameInputState_;          //!< input state for normal ingame playing
+        InputState*              guiMouseOnlyInputState_;  //!< input state if we only need the mouse to use the GUI
+        InputState*              guiKeysOnlyInputState_;   //!< input state if we only need the keys to use the GUI
+        Radar*                   radar_;                   //!< represents the Radar (not the HUD part)
+        CameraManager*           cameraManager_;           //!< camera manager for this level
+        PlayerManager*           playerManager_;           //!< player manager for this level
+        Scope<ScopeID::GSLevel>* scope_GSLevel_;
 
         //##### ConfigValues #####
         std::string           keyDetectorCallbackCode_;

Modified: code/branches/libraries/src/orxonox/objects/quest/AddQuest.h
===================================================================
--- code/branches/libraries/src/orxonox/objects/quest/AddQuest.h	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/objects/quest/AddQuest.h	2009-08-14 01:07:59 UTC (rev 5648)
@@ -34,7 +34,7 @@
 #ifndef _AddQuest_H__
 #define _AddQuest_H__
 
-#include "OrxonoxPrereqs.h"
+#include "objects/quest/QuestPrereqs.h"
 #include "ChangeQuestStatus.h"
 
 namespace orxonox
@@ -42,21 +42,21 @@
     /**
     @brief
         Adds a Quest, resp. changes the quests status to active for the player invoking the Quest.
-        
+
         Creating a AddQuest through XML goes as follows:
-        
+
         <AddQuest questId="id" />  //Where id is a GUID, see http://en.wikipedia.org/wiki/Globally_Unique_Identifier#Basic_structure for more information, and identifies the Quest that should be added.
     @author
         Damian 'Mozork' Frick
     */
-    class _OrxonoxExport AddQuest : public ChangeQuestStatus
+    class _QuestExport AddQuest : public ChangeQuestStatus
     {
         public:
         AddQuest(BaseObject* creator);
         virtual ~AddQuest();
-    
+
         virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a AddQuest object through XML.
-    
+
         virtual bool invoke(PlayerInfo* player); //!< Invokes the QuestEffect.
 
     };

Modified: code/branches/libraries/src/orxonox/objects/quest/AddQuestHint.h
===================================================================
--- code/branches/libraries/src/orxonox/objects/quest/AddQuestHint.h	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/objects/quest/AddQuestHint.h	2009-08-14 01:07:59 UTC (rev 5648)
@@ -34,7 +34,7 @@
 #ifndef _AddQuestHint_H__
 #define _AddQuestHint_H__
 
-#include "OrxonoxPrereqs.h"
+#include "objects/quest/QuestPrereqs.h"
 
 #include <string>
 #include "QuestEffect.h"
@@ -44,14 +44,14 @@
     /**
     @brief
         Adds a QuestHint, resp. activates the QuestHint of the given id for the player the QuestEffect is invoked on.
-        
+
     Creating a AddQuestHint through XML goes as follows:
-        
+
         <AddQuestHint hintId="id" />  //Where id is a GUID, see http://en.wikipedia.org/wiki/Globally_Unique_Identifier#Basic_structure for more information, and identifies the QuestHint that should be added.
     @author
         Damian 'Mozork' Frick
     */
-    class _OrxonoxExport AddQuestHint : public QuestEffect
+    class _QuestExport AddQuestHint : public QuestEffect
     {
         public:
             AddQuestHint(BaseObject* creator);
@@ -70,7 +70,7 @@
             */
             inline const std::string & getHintId(void) const
                 { return this->hintId_; }
-            
+
             bool setHintId(const std::string & id); //!< Sets the id of the QuestHint.
 
     };

Modified: code/branches/libraries/src/orxonox/objects/quest/AddReward.h
===================================================================
--- code/branches/libraries/src/orxonox/objects/quest/AddReward.h	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/objects/quest/AddReward.h	2009-08-14 01:07:59 UTC (rev 5648)
@@ -34,7 +34,7 @@
 #ifndef _AddReward_H__
 #define _AddReward_H__
 
-#include "OrxonoxPrereqs.h"
+#include "objects/quest/QuestPrereqs.h"
 
 #include <list>
 #include "QuestEffect.h"
@@ -44,9 +44,9 @@
     /**
     @brief
         Adds a list of Rewardables to a player.
-        
+
         Creating a AddReward through XML goes as follows:
-        
+
         <AddReward>
             <Rewardable /> //A list of Rewardable objects to be rewarded the player, see the specific Rewardables for their respective XML representations.
             ...
@@ -55,7 +55,7 @@
     @author
         Damian 'Mozork' Frick
     */
-    class _OrxonoxExport AddReward : public QuestEffect
+    class _QuestExport AddReward : public QuestEffect
     {
         public:
             AddReward(BaseObject* creator);
@@ -74,7 +74,7 @@
             */
             inline void addRewardable(Rewardable* reward)
                 { this->rewards_.push_back(reward); }
-        
+
             const Rewardable* getRewardables(unsigned int index) const; //!< Returns the Rewardable object at the given index.
 
     };

Modified: code/branches/libraries/src/orxonox/objects/quest/CMakeLists.txt
===================================================================
--- code/branches/libraries/src/orxonox/objects/quest/CMakeLists.txt	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/objects/quest/CMakeLists.txt	2009-08-14 01:07:59 UTC (rev 5648)
@@ -1,4 +1,4 @@
-ADD_SOURCE_FILES(ORXONOX_SRC_FILES
+SET_SOURCE_FILES(QUEST_SRC_FILES
   AddQuest.cc
   AddQuestHint.cc
   AddReward.cc
@@ -19,3 +19,19 @@
 )
 
 ADD_SUBDIRECTORY(notifications)
+
+# add the parent directory for tolua (TODO: remove this if the quest plugin is moved somewhere else)
+INCLUDE_DIRECTORIES(..)
+
+ORXONOX_ADD_LIBRARY(quest
+  PLUGIN
+  TOLUA_FILES
+    QuestDescription.h
+    QuestManager.h
+  DEFINE_SYMBOL
+    "QUEST_SHARED_BUILD"
+  LINK_LIBRARIES
+    orxonox
+    overlays
+  SOURCE_FILES ${QUEST_SRC_FILES}
+)

Modified: code/branches/libraries/src/orxonox/objects/quest/ChangeQuestStatus.h
===================================================================
--- code/branches/libraries/src/orxonox/objects/quest/ChangeQuestStatus.h	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/objects/quest/ChangeQuestStatus.h	2009-08-14 01:07:59 UTC (rev 5648)
@@ -34,7 +34,7 @@
 #ifndef _ChangeQuestStatus_H__
 #define _ChangeQuestStatus_H__
 
-#include "OrxonoxPrereqs.h"
+#include "objects/quest/QuestPrereqs.h"
 
 #include <string>
 #include "QuestEffect.h"
@@ -47,7 +47,7 @@
     @author
         Damian 'Mozork' Frick
     */
-    class _OrxonoxExport ChangeQuestStatus : public QuestEffect
+    class _QuestExport ChangeQuestStatus : public QuestEffect
     {
         public:
             ChangeQuestStatus(BaseObject* creator);
@@ -67,7 +67,7 @@
 
         private:
             std::string questId_; //!< The id of the Quest the status should be changed of.
-            
+
             bool setQuestId(const std::string & id); //!< Sets the id of the Quest.
 
     };

Modified: code/branches/libraries/src/orxonox/objects/quest/CompleteQuest.h
===================================================================
--- code/branches/libraries/src/orxonox/objects/quest/CompleteQuest.h	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/objects/quest/CompleteQuest.h	2009-08-14 01:07:59 UTC (rev 5648)
@@ -34,7 +34,7 @@
 #ifndef _CompleteQuest_H__
 #define _CompleteQuest_H__
 
-#include "OrxonoxPrereqs.h"
+#include "objects/quest/QuestPrereqs.h"
 #include "ChangeQuestStatus.h"
 
 namespace orxonox
@@ -42,14 +42,14 @@
     /**
     @brief
         Completes a Quest (with a specified id) for the player invoking the QuestEffect.
-        
+
         Creating a CompleteQuest through XML goes as follows:
-        
+
         <CompleteQuest questId="id" />  //Where id is a GUID, see http://en.wikipedia.org/wiki/Globally_Unique_Identifier#Basic_structure for more information, and identifies the Quest that should be completed.
     @author
         Damian 'Mozork' Frick
     */
-    class _OrxonoxExport CompleteQuest : public ChangeQuestStatus
+    class _QuestExport CompleteQuest : public ChangeQuestStatus
     {
         public:
             CompleteQuest(BaseObject* creator);

Modified: code/branches/libraries/src/orxonox/objects/quest/FailQuest.h
===================================================================
--- code/branches/libraries/src/orxonox/objects/quest/FailQuest.h	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/objects/quest/FailQuest.h	2009-08-14 01:07:59 UTC (rev 5648)
@@ -34,7 +34,7 @@
 #ifndef _FailQuest_H__
 #define _FailQuest_H__
 
-#include "OrxonoxPrereqs.h"
+#include "objects/quest/QuestPrereqs.h"
 #include "ChangeQuestStatus.h"
 
 namespace orxonox
@@ -42,14 +42,14 @@
     /**
     @brief
         Fails a quest (with a specified id) for the player invoking the QuestEffect.
-        
+
         Creating a FailQuest through XML goes as follows:
-        
+
         <FailQuest questId="id" />  //Where id is a GUID, see http://en.wikipedia.org/wiki/Globally_Unique_Identifier#Basic_structure for more information, and identifies the Quest that should be failed.
     @author
         Damian 'Mozork' Frick
     */
-    class _OrxonoxExport FailQuest : public ChangeQuestStatus
+    class _QuestExport FailQuest : public ChangeQuestStatus
     {
         public:
             FailQuest(BaseObject* creator);

Modified: code/branches/libraries/src/orxonox/objects/quest/GlobalQuest.h
===================================================================
--- code/branches/libraries/src/orxonox/objects/quest/GlobalQuest.h	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/objects/quest/GlobalQuest.h	2009-08-14 01:07:59 UTC (rev 5648)
@@ -25,7 +25,7 @@
  *      ...
  *
  */
- 
+
 /**
     @file
     @brief Definition of the GlobalQuest class.
@@ -34,7 +34,7 @@
 #ifndef _GlobalQuest_H__
 #define _GlobalQuest_H__
 
-#include "OrxonoxPrereqs.h"
+#include "objects/quest/QuestPrereqs.h"
 
 #include <list>
 #include <set>
@@ -46,9 +46,9 @@
     @brief
         GlobalQuests are Quests, that have the same status for all players.
         This means, that when a player successfully completes a GlobalQuest, it is completed for all players that have it.
-        
+
         Creating a GlobalQuest through XML goes as follows:
-        
+
         <GlobalQuest id="questId"> //Where questId is a GUID, see http://en.wikipedia.org/wiki/Globally_Unique_Identifier#Basic_structure for more information
             <QuestDescription title="Title" description="Description." /> //The description of the quest.
             <subquests>
@@ -80,14 +80,14 @@
     @author
         Damian 'Mozork' Frick
     */
-    class _OrxonoxExport GlobalQuest : public Quest
+    class _QuestExport GlobalQuest : public Quest
     {
         public:
             GlobalQuest(BaseObject* creator);
             virtual ~GlobalQuest();
 
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a GlobalQuest object through XML.
-            
+
             virtual bool fail(PlayerInfo* player); //!< Fails the Quest.
             virtual bool complete(PlayerInfo* player); //!< Completes the Quest.
 
@@ -97,14 +97,14 @@
             virtual bool isCompletable(const PlayerInfo* player) const; //!< Checks whether the Quest can be completed.
 
             virtual QuestStatus::Value getStatus(const PlayerInfo* player) const; //!< Returns the status of the Quest for a specific player.
-            
+
             virtual bool setStatus(PlayerInfo* player, const QuestStatus::Value & status); //!< Sets the status for a specific player.
 
         private:
             std::set<PlayerInfo*> players_; //!< The set of players which possess this Quest.
             QuestStatus::Value status_; //!< The status of this Quest.
             std::list<QuestEffect*> rewards_; //!< Reward QuestEffects only invoked on the player completing the Quest.
-            
+
             bool addRewardEffect(QuestEffect* effect); //!< Adds a reward QuestEffect to the list of reward QuestEffects.
             const QuestEffect* getRewardEffects(unsigned int index) const; //!< Returns the reward QuestEffect at the given index.
 

Modified: code/branches/libraries/src/orxonox/objects/quest/LocalQuest.h
===================================================================
--- code/branches/libraries/src/orxonox/objects/quest/LocalQuest.h	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/objects/quest/LocalQuest.h	2009-08-14 01:07:59 UTC (rev 5648)
@@ -25,7 +25,7 @@
  *      ...
  *
  */
- 
+
 /**
     @file
     @brief Definition of the LocalQuest class.
@@ -34,7 +34,7 @@
 #ifndef _LocalQuest_H__
 #define _LocalQuest_H__
 
-#include "OrxonoxPrereqs.h"
+#include "objects/quest/QuestPrereqs.h"
 
 #include <map>
 #include "Quest.h"
@@ -45,9 +45,9 @@
     @brief
         Handles Quests which have different states for different players.
         LocalQuests have (as opposed to GlobalQuests) a different state for each player, that means if for one player the status of the Quest changes it does not for all the other players which also possess this quest.
-        
+
         Creating a LocalQuest through XML goes as follows:
-        
+
         <LocalQuest id="questId"> //Where questId is a GUID, see http://en.wikipedia.org/wiki/Globally_Unique_Identifier#Basic_structure for more information
             <QuestDescription title="Title" description="Description." /> //The description of the quest.
             <subquests>
@@ -74,14 +74,14 @@
     @author
         Damian 'Mozork' Frick
     */
-    class _OrxonoxExport LocalQuest : public Quest
+    class _QuestExport LocalQuest : public Quest
     {
         public:
             LocalQuest(BaseObject* creator);
             virtual ~LocalQuest();
 
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a LocalQuest object through XML.
-            
+
             virtual bool fail(PlayerInfo* player); //!< Fails the Quest.
             virtual bool complete(PlayerInfo* player); //!< Completes the Quest.
 

Modified: code/branches/libraries/src/orxonox/objects/quest/Quest.h
===================================================================
--- code/branches/libraries/src/orxonox/objects/quest/Quest.h	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/objects/quest/Quest.h	2009-08-14 01:07:59 UTC (rev 5648)
@@ -25,17 +25,17 @@
  *      ...
  *
  */
- 
+
 /**
     @file
     @brief Definition of the Quest class.
         The Quest is the parent class of LocalQuest and GlobalQuest.
 */
- 
+
 #ifndef _Quest_H__
 #define _Quest_H__
 
-#include "OrxonoxPrereqs.h"
+#include "objects/quest/QuestPrereqs.h"
 
 #include <list>
 #include "QuestItem.h"
@@ -61,12 +61,12 @@
         Each Quest exists only once but it has a different status (inactive, active, failed or completed) for each player.
         A Quest has several hints (QuestHint) that can be unlocked through QuestEffects and then display aid in solving the Quest.
         A Quest has a list of QuestEffects that are invoked when the quest is failed and also a list of QuestEffects that are invoked, when the Quest is completed.
-        
+
         Quest itself should not be instantiated, if you want to create a quest either go for LocalQuest or GlobalQuest, whichever suits you needs better.
     @author
         Damian 'Mozork' Frick
     */
-    class _OrxonoxExport Quest : public QuestItem
+    class _QuestExport Quest : public QuestItem
     {
         public:
             Quest(BaseObject* creator);
@@ -80,7 +80,7 @@
             */
             inline Quest* getParentQuest(void) const
                 { return this->parentQuest_; }
-                
+
             /**
             @brief Returns the list of subquests.
             @return Returns a reference to the list of subquests of the quest.
@@ -94,16 +94,16 @@
             */
             inline const std::list<QuestHint*> & getHintsList(void) const
                 { return this->hints_; }
-        
+
             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 start(PlayerInfo* player); //!< Sets a Quest to active.
             virtual bool fail(PlayerInfo* player); //!< Fails the Quest.
             virtual bool complete(PlayerInfo* player); //!< Completes the Quest.
-        
+
             bool addListener(QuestListener* listener); //!< Adds a QuestListener to the list of QuestListeners listening to this Quest.
 
         protected:
@@ -115,14 +115,14 @@
             const QuestHint* getHint(unsigned int index) const; //!< Returns the QuestHint at the given index.
             const QuestEffect* getFailEffect(unsigned int index) const; //!< Returns the fail QuestEffect at the given index.
             const QuestEffect* getCompleteEffect(unsigned int index) const; //!< Returns the complete QuestEffect at the given index.
-            
+
             /**
             @brief Returns the list of fail QuestEffects.
             @return Returns a reference to the list of fail QuestEffects.
             */
             inline std::list<QuestEffect*> & getFailEffectList(void)
                 { return this->failEffects_; }
-                
+
             /**
             @brief Returns the list of complete QuestEffects.
             @return Returns a reference to the list of complete QuestEffects.
@@ -132,7 +132,7 @@
 
             virtual QuestStatus::Value getStatus(const PlayerInfo* player) const = 0; //!< Returns the status of the Quest for a specific player.
             virtual bool setStatus(PlayerInfo* player, const QuestStatus::Value & status) = 0; //!< Changes the status for a specific player.
-            
+
         private:
             Quest* parentQuest_; //!< Pointer to the parentquest.
             std::list<Quest*> subQuests_; //!< List of all the subquests.
@@ -141,9 +141,9 @@
 
             std::list<QuestEffect*> failEffects_; //!< A list of all QuestEffects to be invoked, when the Quest has been failed.
             std::list<QuestEffect*> completeEffects_; //!< A list of QuestEffects to be invoked, when the Quest has been completed.
-            
+
             std::list<QuestListener*> listeners_; //!< A list of QuestListeners, that listen to what exactly happens with this Quest.
-            
+
             bool setParentQuest(Quest* quest); //!< Sets the parentquest of the Quest.
             bool addSubQuest(Quest* quest); //!< Adds a subquest to the Quest.
             bool addHint(QuestHint* hint); //!< Add a QuestHint to the list of QuestHints.

Modified: code/branches/libraries/src/orxonox/objects/quest/QuestDescription.h
===================================================================
--- code/branches/libraries/src/orxonox/objects/quest/QuestDescription.h	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/objects/quest/QuestDescription.h	2009-08-14 01:07:59 UTC (rev 5648)
@@ -34,7 +34,7 @@
 #ifndef _QuestDescription_H__
 #define _QuestDescription_H__
 
-#include "OrxonoxPrereqs.h"
+#include "objects/quest/QuestPrereqs.h"
 
 #include <string>
 #include "core/BaseObject.h"
@@ -46,14 +46,14 @@
     @brief
         This class is a description of a QuestItem.
         It holds a title and a description.
-        
+
         Creating a QuestDescription through XML goes as follows:
-        
+
         <QuestDescription title="Title" description="Description Text" failMessage="You fail." completeMessage="You win!" />
     @author
         Damian 'Mozork' Frick
     */
-    class _OrxonoxExport QuestDescription : public BaseObject
+    class _QuestExport QuestDescription : public BaseObject
     {
 // tolua_end
         public:
@@ -69,7 +69,7 @@
             */
             inline const std::string & getTitle(void) const
                 { return this->title_; }
-        
+
             /**
             @brief Returns the description text.
             @return Returns a string containing the description text of the QuestDescription.
@@ -77,42 +77,42 @@
             inline const std::string & getDescription(void) const
                 { return this->description_; }
 // tolua_end
-        
+
             /**
             @brief Returns the fail message.
             @return Returns a string containing the fail message of the QuestDescription.
             */
             inline const std::string & getFailMessage(void) const
                 { return this->failMessage_; }
-        
+
             /**
             @brief Returns the complete message.
             @return Returns a string containing the complete message of the QuestDescription.
             */
             inline const std::string & getCompleteMessage(void) const
                 { return this->completeMessage_; }
-        
+
             /**
             @brief Sends a Notification displaying that a QuestHint was added.
             @return Returns true if successful.
             */
             inline bool sendAddHintNotification(void) const
                 { return notificationHelper("hint", ""); }
-        
+
             /**
             @brief Sends a Notification displaying that a Quest was added.
             @return Returns true if successful.
             */
             inline bool sendAddQuestNotification(void) const
                 { return notificationHelper("quest", "start"); }
-        
+
             /**
             @brief Sends a Notification displaying that a Quest was failed.
             @return Returns true if successful.
             */
             inline bool sendFailQuestNotification(void) const
                 { return notificationHelper("quest", "fail"); }
-        
+
             /**
             @brief Sends a Notification displaying that a Quest was completed.
             @return Returns true if successful.
@@ -134,7 +134,7 @@
             */
             inline void setTitle(const std::string & title)
                 { this->title_ = title; }
-                
+
             /**
             @brief Sets the description text.
             @param description The description text to be set.
@@ -148,7 +148,7 @@
             */
             inline void setFailMessage(const std::string & message)
                 { this->failMessage_ = message; }
-                
+
             /**
             @brief Sets the complete message.
             @param message The complete message to be set.

Modified: code/branches/libraries/src/orxonox/objects/quest/QuestEffect.h
===================================================================
--- code/branches/libraries/src/orxonox/objects/quest/QuestEffect.h	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/objects/quest/QuestEffect.h	2009-08-14 01:07:59 UTC (rev 5648)
@@ -25,7 +25,7 @@
  *      ...
  *
  */
- 
+
 /**
     @file
     @brief Definition of the QuestEffect class.
@@ -34,7 +34,7 @@
 #ifndef _QuestEffect_H__
 #define _QuestEffect_H__
 
-#include "OrxonoxPrereqs.h"
+#include "objects/quest/QuestPrereqs.h"
 
 #include <list>
 #include "core/BaseObject.h"
@@ -48,7 +48,7 @@
     @author
         Damian 'Mozork' Frick
     */
-    class _OrxonoxExport QuestEffect : public BaseObject
+    class _QuestExport QuestEffect : public BaseObject
     {
         public:
             QuestEffect(BaseObject* creator);

Modified: code/branches/libraries/src/orxonox/objects/quest/QuestEffectBeacon.h
===================================================================
--- code/branches/libraries/src/orxonox/objects/quest/QuestEffectBeacon.h	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/objects/quest/QuestEffectBeacon.h	2009-08-14 01:07:59 UTC (rev 5648)
@@ -34,7 +34,7 @@
 #ifndef _QuestEffectBeacon_H__
 #define _QuestEffectBeacon_H__
 
-#include "OrxonoxPrereqs.h"
+#include "objects/quest/QuestPrereqs.h"
 
 #include <list>
 #include "orxonox/objects/worldentities/StaticEntity.h"
@@ -57,9 +57,9 @@
         The conditions under which the QuestEffects are invoked on the player are defined by Triggers.
         A QuestEffectBeacon can be executed a defined number of times.
         A QuestEffectBeacon can be inactive or active.
-        
+
         Creating a QuestEffectBeacon through XML goes as follows:
-        
+
         <QuestEffectBeacon times=n> //Where 'n' is eighter a number >= 0, which means the QuestEffectBeacon can be executed n times. Or n = -1, which means the QuestEffectBeacon can be executed an infinite number of times.
             <effects>
                 <QuestEffect /> //A list of QuestEffects, invoked when the QuestEffectBeacon is executed, see QuestEffect for the full XML representation.
@@ -78,49 +78,49 @@
     @author
         Damian 'Mozork' Frick
     */
-    class _OrxonoxExport QuestEffectBeacon : public StaticEntity
+    class _QuestExport QuestEffectBeacon : public StaticEntity
     {
         public:
             QuestEffectBeacon(BaseObject* creator);
             virtual ~QuestEffectBeacon();
-            
+
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestEffectBeacon object through XML.
-            
+
             virtual void processEvent(Event& event); //!< Processes an event for this QuestEffectBeacon.
-            
+
             bool execute(bool b, PlayerTrigger* trigger); //!< Executes the QuestEffects of the QuestEffectBeacon.
-            
+
             /**
             @brief Tests whether the QuestEffectBeacon is active.
             @return Returns true if the QuestEffectBeacon is active, fals if not.
             */
             inline bool isActive(void)
             { return this->status_ == QuestEffectBeaconStatus::Active; }
-            
+
             bool setActive(bool activate); //!< Set the status of the QuestEffectBeacon.
-            
+
         protected:
             bool decrementTimes(void); //!< Decrement the number of times the QuestEffectBeacon can still be executed.
-            
+
             /**
             @brief Returns the number of times the QUestEffectBeacon can still be executed.
             @return Returns the number of times the QUestEffectBeacon can still be executed.
             */
             inline const int & getTimes(void) const
                 { return this->times_; }
-    
+
         private:
             static const int INFINITE_TIME = -1; //!< Constant to avoid using magic numbers.
-            
+
             std::list<QuestEffect*> effects_; //!< The list of QuestEffects to be invoked on the executing player.
             int times_; //!< Number of times the beacon can be exectued.
             QuestEffectBeaconStatus::Value status_; //!< The status of the QUestEffectBeacon, Can be eighter active or inactive.
-            
+
             bool setTimes(const int & n); //!< Set the number of times the QuestEffectBeacon can be executed.
             bool addEffect(QuestEffect* effect); //!< Add a QuestEffect to the QuestEffectBeacon.
-            
+
             const QuestEffect* getEffect(unsigned int index) const; //!< Get the QuestEffect at a given index.
-    
+
     };
 
 }

Modified: code/branches/libraries/src/orxonox/objects/quest/QuestHint.h
===================================================================
--- code/branches/libraries/src/orxonox/objects/quest/QuestHint.h	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/objects/quest/QuestHint.h	2009-08-14 01:07:59 UTC (rev 5648)
@@ -25,7 +25,7 @@
  *      ...
  *
  */
- 
+
 /**
     @file
     @brief Definition of the QuestHint class.
@@ -34,7 +34,7 @@
 #ifndef _QuestHint_H__
 #define _QuestHint_H__
 
-#include "OrxonoxPrereqs.h"
+#include "objects/quest/QuestPrereqs.h"
 
 #include <map>
 #include "QuestItem.h"
@@ -56,16 +56,16 @@
         Represents a hint in the game towards completing a Quest.
         Consists of title and description (which is stored in a QuestDescription object) in textual form and must belong to a quest.
         A QuestHint has a defined status (inactive or active, where inactive is default) for each player, which means each a QuestHint exists only once for all players, it doesn't belong to a player, it just has different states for each of them.
-        
+
         Creating a QuestHint through XML goes as follows:
-        
+
         <QuestHint id="hintId">  //Where hintId is a GUID, see http://en.wikipedia.org/wiki/Globally_Unique_Identifier#Basic_structure for more information
             <QuestDesctription title="" description="" />
         </QuestHint>
     @author
         Damian 'Mozork' Frick
     */
-    class _OrxonoxExport QuestHint : public QuestItem
+    class _QuestExport QuestHint : public QuestItem
     {
 
         public:

Modified: code/branches/libraries/src/orxonox/objects/quest/QuestItem.h
===================================================================
--- code/branches/libraries/src/orxonox/objects/quest/QuestItem.h	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/objects/quest/QuestItem.h	2009-08-14 01:07:59 UTC (rev 5648)
@@ -25,7 +25,7 @@
  *      ...
  *
  */
- 
+
 /**
     @file
     @brief Definition of the QuestItem class.
@@ -36,7 +36,7 @@
 #ifndef _QuestItem_H__
 #define _QuestItem_H__
 
-#include "OrxonoxPrereqs.h"
+#include "objects/quest/QuestPrereqs.h"
 
 #include <string>
 #include "core/BaseObject.h"
@@ -50,7 +50,7 @@
     @author
         Damian 'Mozork' Frick
     */
-    class _OrxonoxExport QuestItem : public BaseObject
+    class _QuestExport QuestItem : public BaseObject
     {
 
         public:
@@ -65,7 +65,7 @@
             */
             inline const std::string & getId(void) const
                 { return this->id_; }
-            
+
             /**
             @brief Returns the QuestDescription of the QuestItem.
             @return Returns a pointer to the QuestDescription object of the QuestItem.
@@ -77,7 +77,7 @@
 
         protected:
             void setId(const std::string & id); //!< Sets the id of the QuestItem.
-            
+
             /**
             @brief Sets the description of the QuestItem.
             @param description The QuestDescription to be set.

Modified: code/branches/libraries/src/orxonox/objects/quest/QuestListener.h
===================================================================
--- code/branches/libraries/src/orxonox/objects/quest/QuestListener.h	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/objects/quest/QuestListener.h	2009-08-14 01:07:59 UTC (rev 5648)
@@ -34,7 +34,7 @@
 #ifndef _QuestListener_H__
 #define _QuestListener_H__
 
-#include "OrxonoxPrereqs.h"
+#include "objects/quest/QuestPrereqs.h"
 
 #include <string>
 #include <list>
@@ -57,10 +57,10 @@
     /**
     @brief
         Provides a way to react to the starting, completing and failing of Quests.
-        
+
         The XML representation goes as follows:
         You can use the QuestListener as if it were a Trigger or EventListener, that fires an Event when the status (depending on the set mode) of the given Quest changes.
-        
+
         <BaseObject> // The object that should react to the status change of a Quest.
             <events>
                 <function> // Where function is the method of the object that schould be executed. Normally this would be visibility or activity.
@@ -71,28 +71,28 @@
     @author
     Damian 'Mozork' Frick
     */
-    class _OrxonoxExport QuestListener : public BaseObject
+    class _QuestExport QuestListener : public BaseObject
     {
     public:
         QuestListener(BaseObject* creator);
         virtual ~QuestListener();
-        
+
         virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestListener object through XML.
-        
+
         static void advertiseStatusChange(std::list<QuestListener*> & listeners, const std::string & status); //!< Makes all QuestListener in the list aware that a certain status change has occured.
-        
+
         bool setQuestId(const std::string & id); //!< Sets the questId of the Quest the QuestListener reacts to.
         bool setMode(const std::string & mode); //!< Sets the mode of the QuestListener.
-        
+
         std::string getMode(void); //!< Get the mode of the QuestListener.
-        
-        const std::string & getQuestId(void);        
+
+        const std::string & getQuestId(void);
         bool execute(void); //!< Executes the QuestListener, resp. fires an Event.
-        
+
     private:
         QuestListenerMode::Value mode_; //!< The mode of the QuestListener.
         Quest* quest_; //!< A pointer to the Quest the QuestListener is reacting to.
-    
+
     };
 
 }

Modified: code/branches/libraries/src/orxonox/objects/quest/QuestManager.cc
===================================================================
--- code/branches/libraries/src/orxonox/objects/quest/QuestManager.cc	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/objects/quest/QuestManager.cc	2009-08-14 01:07:59 UTC (rev 5648)
@@ -35,6 +35,7 @@
 
 #include "util/Exception.h"
 #include "core/CoreIncludes.h"
+#include "core/GUIManager.h"
 
 #include "objects/infos/PlayerInfo.h"
 #include "Quest.h"
@@ -63,7 +64,6 @@
     */
     QuestManager::~QuestManager()
     {
-
     }
 
     /**
@@ -206,7 +206,7 @@
     */
     QuestContainer* QuestManager::getQuestTree(std::string & name)
     {
-        PlayerInfo* player = this->players_[name];
+        PlayerInfo* player = GUIManager::getInstance().getPlayer(name);
         if(player == NULL)
         {
             COUT(1) << "Error: GUIOverlay with name '" << name << "' has no player." << std::endl;

Modified: code/branches/libraries/src/orxonox/objects/quest/QuestManager.h
===================================================================
--- code/branches/libraries/src/orxonox/objects/quest/QuestManager.h	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/objects/quest/QuestManager.h	2009-08-14 01:07:59 UTC (rev 5648)
@@ -34,13 +34,13 @@
 #ifndef _QuestManager_H__
 #define _QuestManager_H__
 
-#include "OrxonoxPrereqs.h"
+#include "objects/quest/QuestPrereqs.h"
 
 #include <list>
 #include <map>
 #include <string>
 
-#include "util/Singleton.h"
+#include "util/ScopedSingleton.h"
 #include "core/OrxonoxClass.h"
 
 // tolua_begin
@@ -65,6 +65,8 @@
         HintContainer* next;
     };
 
+    typedef ScopedSingleton<QuestManager, ScopeID::GSLevel> ScopedSingletonQuestManagerGSLevel; // workaround for tolua
+
     /**
     @brief
         Is a Singleton and manages Quests, by registering every Quest/QuestHint (through registerX()) and making them globally accessable (through findX()).
@@ -72,16 +74,16 @@
     @author
         Damian 'Mozork' Frick
     */
-    class _OrxonoxExport QuestManager : public Singleton<QuestManager>, public orxonox::OrxonoxClass
+    class _QuestExport QuestManager : public ScopedSingletonQuestManagerGSLevel, public orxonox::OrxonoxClass
     {
 // tolua_end
-            friend class Singleton<QuestManager>;
+            friend class ScopedSingleton<QuestManager, ScopeID::GSLevel>;
         public:
             QuestManager();
             virtual ~QuestManager();
 
             //! Returns a reference to the single instance of the Quest Manager.
-            static QuestManager& getInstance() { return Singleton<QuestManager>::getInstance(); } // tolua_export
+            static QuestManager& getInstance() { return ScopedSingleton<QuestManager, ScopeID::GSLevel>::getInstance(); } // tolua_export
 
             bool registerQuest(Quest* quest); //!< Registers a Quest in the QuestManager.
             bool registerHint(QuestHint* quest); //!< Registers a QuestHint in the QuestManager.
@@ -91,17 +93,11 @@
 
             QuestContainer* getQuestTree(std::string & name); // tolua_export
 
-            inline void setPlayer(const std::string& guiname, PlayerInfo* player)
-                { this->players_[guiname] = player; }
-            inline PlayerInfo* getPlayer(const std::string& guiname) const
-                { std::map<std::string, PlayerInfo*>::const_iterator it = this->players_.find(guiname); return (it != this->players_.end()) ? it->second : 0; }
-
         private:
             static QuestManager* singletonPtr_s;
 
             std::map<std::string, Quest*> questMap_; //!< All Quests registered by their id's.
             std::map<std::string, QuestHint*> hintMap_; //!< All QuestHints registered by their id's.
-            std::map<std::string, PlayerInfo*> players_; //!< Stores the player (owner) for each gui
 
             void getRootQuests(const PlayerInfo* player, std::list<Quest*> & list);
             HintContainer* addHints(Quest* quest, const PlayerInfo* player);

Modified: code/branches/libraries/src/orxonox/objects/quest/QuestNotification.h
===================================================================
--- code/branches/libraries/src/orxonox/objects/quest/QuestNotification.h	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/objects/quest/QuestNotification.h	2009-08-14 01:07:59 UTC (rev 5648)
@@ -29,7 +29,7 @@
 #ifndef _QuestNotification_H__
 #define _QuestNotification_H__
 
-#include "OrxonoxPrereqs.h"
+#include "objects/quest/QuestPrereqs.h"
 
 #include <string>
 #include "notifications/Notification.h"
@@ -42,7 +42,7 @@
     @author
         Damian 'Mozork' Frick
     */
-    class _OrxonoxExport QuestNotification : public Notification
+    class _QuestExport QuestNotification : public Notification
     {
         public:
             QuestNotification(BaseObject* creator);

Added: code/branches/libraries/src/orxonox/objects/quest/QuestPrereqs.h
===================================================================
--- code/branches/libraries/src/orxonox/objects/quest/QuestPrereqs.h	                        (rev 0)
+++ code/branches/libraries/src/orxonox/objects/quest/QuestPrereqs.h	2009-08-14 01:07:59 UTC (rev 5648)
@@ -0,0 +1,92 @@
+/*
+ *   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:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+  @file
+  @brief Contains all the necessary forward declarations for all classes and structs.
+*/
+
+#ifndef _QuestsystemPrereqs_H__
+#define _QuestsystemPrereqs_H__
+
+#include "OrxonoxConfig.h"
+
+#include "OrxonoxPrereqs.h"
+
+//-----------------------------------------------------------------------
+// Shared library settings
+//-----------------------------------------------------------------------
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(ORXONOX_STATIC_BUILD)
+#  ifdef QUEST_SHARED_BUILD
+#    define _QuestExport __declspec(dllexport)
+#  else
+#    if defined( __MINGW32__ )
+#      define _QuestExport
+#    else
+#      define _QuestExport __declspec(dllimport)
+#    endif
+#  endif
+#elif defined ( ORXONOX_GCC_VISIBILITY )
+#  define _QuestExport  __attribute__ ((visibility("default")))
+#else
+#  define _QuestExport
+#endif
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+    class AddQuest;
+    class AddQuestHint;
+    class AddReward;
+    class ChangeQuestStatus;
+    class CompleteQuest;
+    class FailQuest;
+    class GlobalQuest;
+    class LocalQuest;
+    class Quest;
+    class QuestDescription;
+    class QuestEffect;
+    class QuestEffectBeacon;
+    class QuestHint;
+    class QuestItem;
+    class QuestListener;
+    class QuestManager;
+    class QuestNotification;
+    class Rewardable;
+
+    class Notification;
+    class NotificationListener;
+    class NotificationManager;
+    class NotificationOverlay;
+    class NotificationQueue;
+}
+
+#endif /* _QuestsystemPrereqs_H__ */


Property changes on: code/branches/libraries/src/orxonox/objects/quest/QuestPrereqs.h
___________________________________________________________________
Added: svn:eol-style
   + native

Modified: code/branches/libraries/src/orxonox/objects/quest/notifications/CMakeLists.txt
===================================================================
--- code/branches/libraries/src/orxonox/objects/quest/notifications/CMakeLists.txt	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/objects/quest/notifications/CMakeLists.txt	2009-08-14 01:07:59 UTC (rev 5648)
@@ -1,4 +1,6 @@
-ADD_SOURCE_FILES(ORXONOX_SRC_FILES
+ADD_SOURCE_FILES(QUEST_SRC_FILES
   Notification.cc
   NotificationManager.cc
+  NotificationOverlay.cc
+  NotificationQueue.cc
 )

Modified: code/branches/libraries/src/orxonox/objects/quest/notifications/Notification.h
===================================================================
--- code/branches/libraries/src/orxonox/objects/quest/notifications/Notification.h	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/objects/quest/notifications/Notification.h	2009-08-14 01:07:59 UTC (rev 5648)
@@ -34,7 +34,7 @@
 #ifndef _Notification_H__
 #define _Notification_H__
 
-#include "OrxonoxPrereqs.h"
+#include "objects/quest/QuestPrereqs.h"
 
 #include <string>
 #include "core/BaseObject.h"
@@ -48,7 +48,7 @@
     @author
         Damian 'Mozork' Frick
     */
-    class _OrxonoxExport Notification : public BaseObject
+    class _QuestExport Notification : public BaseObject
     {
         public:
             Notification(BaseObject* creator);

Modified: code/branches/libraries/src/orxonox/objects/quest/notifications/NotificationManager.h
===================================================================
--- code/branches/libraries/src/orxonox/objects/quest/notifications/NotificationManager.h	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/objects/quest/notifications/NotificationManager.h	2009-08-14 01:07:59 UTC (rev 5648)
@@ -34,13 +34,13 @@
 #ifndef _NotificationManager_H__
 #define _NotificationManager_H__
 
-#include "OrxonoxPrereqs.h"
+#include "objects/quest/QuestPrereqs.h"
 
 #include <ctime>
 #include <map>
 #include <string>
 
-#include "util/Singleton.h"
+#include "util/ScopedSingleton.h"
 #include "core/OrxonoxClass.h"
 
 namespace orxonox
@@ -53,9 +53,9 @@
     @author
         Damian 'Mozork' Frick
     */
-    class _OrxonoxExport NotificationManager : public Singleton<NotificationManager>, public OrxonoxClass
+    class _QuestExport NotificationManager : public ScopedSingleton<NotificationManager, ScopeID::GSLevel>, public OrxonoxClass
     {
-            friend class Singleton<NotificationManager>;
+            friend class ScopedSingleton<NotificationManager, ScopeID::GSLevel>;
         public:
             NotificationManager();
             virtual ~NotificationManager();

Copied: code/branches/libraries/src/orxonox/objects/quest/notifications/NotificationOverlay.cc (from rev 5646, code/branches/libraries/src/orxonox/overlays/notifications/NotificationOverlay.cc)
===================================================================
--- code/branches/libraries/src/orxonox/objects/quest/notifications/NotificationOverlay.cc	                        (rev 0)
+++ code/branches/libraries/src/orxonox/objects/quest/notifications/NotificationOverlay.cc	2009-08-14 01:07:59 UTC (rev 5648)
@@ -0,0 +1,136 @@
+/*
+ *   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 Implementation of the NotificationOverlay class.
+*/
+
+#include "NotificationOverlay.h"
+
+#include "util/Exception.h"
+#include "core/CoreIncludes.h"
+#include "objects/quest/notifications/Notification.h"
+#include "NotificationQueue.h"
+
+namespace orxonox
+{
+
+    /**
+    @brief
+        Constructor. Intializes the class.
+    */
+    NotificationOverlay::NotificationOverlay(BaseObject* creator) : OverlayText(creator)
+    {
+        RegisterObject(NotificationOverlay);
+        this->initialize();
+    }
+
+    /**
+    @brief
+        Constructor. Initializes the class creates a graphical representation of the input Notification for the input Queue.
+    @param queue
+        A pointer to the queue the NotificatonOverlay belongs to.
+    @param notification
+        A pointer to the Notification represented by this overlay.
+    @throws Argument
+        Throws an Argument-Exception if either no Notification or no NotificationQueue were input.
+    */
+    NotificationOverlay::NotificationOverlay(NotificationQueue* queue, Notification* notification) : OverlayText(NULL)
+    {
+        this->initialize();
+
+        if(notification == NULL || queue == NULL) //!> If either notification or queue are not given an Exception is thrown.
+        {
+            ThrowException(Argument, "There were NULL-Pointer arguments in NotificationOverlay creation.");
+        }
+
+        this->queue_ = queue;
+        this->defineOverlay();
+
+        this->processNotification(notification);
+    }
+
+    /**
+    @brief
+        Initializes and Registers the object.
+    */
+    void NotificationOverlay::initialize(void)
+    {
+        this->queue_ = NULL;
+    }
+
+    /**
+    @brief
+        Set some Overlay-specific values.
+    */
+    void NotificationOverlay::defineOverlay(void)
+    {
+        this->setFont(this->queue_->getFont());
+        this->setTextSize(this->queue_->getFontSize());
+
+        this->setPosition(this->queue_->getPosition());
+    }
+
+    /**
+    @brief
+        Destructor.
+    */
+    NotificationOverlay::~NotificationOverlay()
+    {
+    }
+
+    /**
+    @brief
+        Processes the input notification, resp. sees to it. that the NotificationOverlay displays the Notification message.
+    @param notification
+        A pointer to the notification that should be processed.
+    @return
+        Returns true if successful.
+    */
+    bool NotificationOverlay::processNotification(Notification* notification)
+    {
+        if(notification == NULL)
+            return false;
+        this->setCaption(clipMessage(notification->getMessage()));
+        this->notification_ = notification;
+        return true;
+    }
+
+    /**
+    @brief
+        Clips the input message so that it meets the requirements for the maximal length of Notifications given by the NotificationQueue.
+    */
+    std::string NotificationOverlay::clipMessage(const std::string & message)
+    {
+        if(message.length() <= static_cast<unsigned int>(this->queue_->getNotificationLength())) //!< If the message is not too long.
+            return message;
+        return message.substr(0, this->queue_->getNotificationLength());
+    }
+
+}

Copied: code/branches/libraries/src/orxonox/objects/quest/notifications/NotificationOverlay.h (from rev 5646, code/branches/libraries/src/orxonox/overlays/notifications/NotificationOverlay.h)
===================================================================
--- code/branches/libraries/src/orxonox/objects/quest/notifications/NotificationOverlay.h	                        (rev 0)
+++ code/branches/libraries/src/orxonox/objects/quest/notifications/NotificationOverlay.h	2009-08-14 01:07:59 UTC (rev 5648)
@@ -0,0 +1,83 @@
+/*
+ *   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 NotificationOverlay class.
+*/
+
+
+#ifndef _NotificationOverlay_H__
+#define _NotificationOverlay_H__
+
+#include "objects/quest/QuestPrereqs.h"
+
+#include <string>
+#include "orxonox/overlays/OverlayText.h"
+
+namespace orxonox
+{
+
+    /**
+    @brief
+        The NotificationOverlay is used to display single Notifications, then bundled in a NotificationQUeue.
+    @author
+        Damian 'Mozork' Frick
+    */
+    class _QuestExport NotificationOverlay : public OverlayText
+    {
+
+        public:
+            NotificationOverlay(BaseObject* creator);
+            NotificationOverlay(NotificationQueue* queue, Notification* notification);
+            virtual ~NotificationOverlay();
+
+            bool processNotification(Notification* notification); //!< Processes the input Notification.
+
+            /**
+            @brief Sets the font size of this overlay's text.
+            @param size The font size.
+            */
+            inline void setFontSize(float size)
+                { this->setTextSize(size); }
+
+        protected:
+            std::string clipMessage(const std::string & message); //!< Clips the input message if too long.
+
+        private:
+            NotificationQueue* queue_; //!< The NotificationQeue this overlay belongs to.
+            Notification* notification_; //!< The Notification this overlay displays.
+
+            void initialize(void); //!< Initializes the object.
+            void defineOverlay(void); //!< Sets some overlay-specific values.
+
+    };
+
+}
+
+#endif /* _NotificationOverlay_H__ */

Copied: code/branches/libraries/src/orxonox/objects/quest/notifications/NotificationQueue.cc (from rev 5646, code/branches/libraries/src/orxonox/overlays/notifications/NotificationQueue.cc)
===================================================================
--- code/branches/libraries/src/orxonox/objects/quest/notifications/NotificationQueue.cc	                        (rev 0)
+++ code/branches/libraries/src/orxonox/objects/quest/notifications/NotificationQueue.cc	2009-08-14 01:07:59 UTC (rev 5648)
@@ -0,0 +1,449 @@
+/*
+ *   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 Implementation of the NotificationQueue class.
+*/
+
+#include "NotificationQueue.h"
+
+#include <sstream>
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "NotificationOverlay.h"
+#include "objects/quest/notifications/NotificationManager.h"
+
+namespace orxonox
+{
+
+    CreateFactory(NotificationQueue);
+
+    const std::string NotificationQueue::DEFAULT_FONT = "VeraMono";
+    const Vector2 NotificationQueue::DEFAULT_POSITION = Vector2(0.0,0.0);
+    const float NotificationQueue::DEFAULT_FONT_SIZE  = 0.025f;
+
+    /**
+    @brief
+        Constructor. Creates and initializes the object.
+    */
+    NotificationQueue::NotificationQueue(BaseObject* creator) : OverlayGroup(creator)
+    {
+        RegisterObject(NotificationQueue);
+        this->initialize();
+    }
+
+    /**
+    @brief
+        Destructor.
+    */
+    NotificationQueue::~NotificationQueue()
+    {
+        this->targets_.clear();
+        this->clear();
+    }
+
+    /**
+    @brief
+        Initializes the object.
+        Registers the object, initializes variables, sets default values and registers the queue with the NotificationManager.
+    */
+    void NotificationQueue::initialize(void)
+    {
+        this->size_ = 0;
+        this->tickTime_ = 0.0;
+
+        NotificationManager::getInstance().registerListener(this);
+    }
+
+    /**
+    @brief
+        Sets the defaults.
+    */
+    void NotificationQueue::setDefaults(void)
+    {
+        this->setMaxSize(DEFAULT_SIZE);
+        this->setNotificationLength(DEFAULT_LENGTH);
+        this->setDisplayTime(DEFAULT_DISPLAY_TIME);
+        this->setPosition(DEFAULT_POSITION);
+
+        this->setTargets(NotificationManager::ALL);
+
+        this->setFontSize(DEFAULT_FONT_SIZE);
+        this->setFont(DEFAULT_FONT);
+    }
+
+    /**
+    @brief
+        Method for creating a NotificationQueue object through XML.
+    */
+    void NotificationQueue::XMLPort(Element& xmlElement, XMLPort::Mode mode)
+    {
+        SUPER(NotificationQueue, XMLPort, xmlElement, mode);
+
+        this->setDefaults();
+
+        XMLPortParam(NotificationQueue, "maxSize", setMaxSize, getMaxSize, xmlElement, mode);
+        XMLPortParam(NotificationQueue, "notificationLength", setNotificationLength, getNotificationLength, xmlElement, mode);
+        XMLPortParam(NotificationQueue, "displayTime", setDisplayTime, getDisplayTime, xmlElement, mode);
+        XMLPortParam(NotificationQueue, "targets", setTargets, getTargets, xmlElement, mode);
+        XMLPortParam(NotificationQueue, "font", setFont, getFont, xmlElement, mode);
+        XMLPortParam(NotificationQueue, "fontSize", setFontSize, getFontSize, xmlElement, mode);
+        XMLPortParam(NotificationQueue, "position", setPosition, getPosition, xmlElement, mode);
+
+        COUT(3) << "NotificationQueue created." << std::endl;
+    }
+
+    /**
+    @brief
+        Updates the queue from time to time.
+    @param dt
+        The time interval that has passed since the last tick.
+    */
+    void NotificationQueue::tick(float dt)
+    {
+        this->tickTime_ += dt; //!< Add the time interval that has passed to the time counter.
+        if(this->tickTime_ >= 1.0) //!< If the time counter is greater than 1s all Notifications that have expired are removed, if it is smaller we wait to the next tick.
+        {
+            this->timeLimit_.time = std::time(0)-this->displayTime_; //!< Container containig the current time.
+
+            std::multiset<NotificationOverlayContainer*, NotificationOverlayContainerCompare>::iterator it;
+            it = this->containers_.begin();
+            while(it != this->containers_.upper_bound(&this->timeLimit_)) //!< Iterate through all elements whose creation time is smaller than the current time minus the display time.
+            {
+                this->removeContainer(*it);
+                this->scroll(Vector2(0.0,-(1.1*this->getFontSize())));
+                it = this->containers_.begin(); //TDO: Needed?
+            }
+
+            this->tickTime_ = 0.0; //!< Reset time counter.
+        }
+    }
+
+    /**
+    @brief
+        Updates the NotificationQueue.
+        Updates by clearing the queue and requesting all relevant Notifications from the NotificationManager and inserting the in the queue.
+    */
+    void NotificationQueue::update(void)
+    {
+        this->clear();
+
+        std::multimap<std::time_t,Notification*>* notifications = new std::multimap<std::time_t,Notification*>;
+        if(!NotificationManager::getInstance().getNotifications(this, notifications, this->displayTime_)) //!< Get the Notifications sent in the interval form now to minus the display time.
+        {
+            COUT(1) << "NotificationQueue update failed due to undetermined cause." << std::endl;
+            return;
+        }
+
+        if(notifications->empty())
+            return;
+
+        for(std::multimap<std::time_t,Notification*>::iterator it = notifications->begin(); it != notifications->end(); it++) //!> Add all Notifications.
+        {
+            this->addNotification(it->second, it->first);
+        }
+
+        delete notifications;
+
+        COUT(3) << "NotificationQueue updated." << std::endl;
+    }
+
+    /**
+    @brief
+        Updates the NotificationQueue by adding an new Notification.
+    @param notification
+        Pointer to the Notification.
+    @param time
+        The time the Notification was sent.
+    */
+    void NotificationQueue::update(Notification* notification, const std::time_t & time)
+    {
+        this->addNotification(notification, time);
+
+        std::multiset<NotificationOverlayContainer*, NotificationOverlayContainerCompare>::iterator it;
+        while(this->getSize() > this->getMaxSize())
+        {
+            it = this->containers_.begin();
+            this->removeContainer(*it);
+            this->scroll(Vector2(0.0,-(1.1*this->getFontSize())));
+        }
+
+        COUT(3) << "NotificationQueue updated. A new Notifications has been added." << std::endl;
+    }
+
+    /**
+    @brief
+        Sets the maximum number of displayed Notifications.
+    @param size
+        The size to be set.
+    @return
+        Returns true if successful.
+    */
+    bool NotificationQueue::setMaxSize(int size)
+    {
+        if(size < 0)
+            return false;
+        this->maxSize_ = size;
+        this->update();
+        return true;
+    }
+
+    /**
+    @brief
+        Sets the maximum number of characters a Notification message displayed by this queue is allowed to have.
+    @param length
+        The length to be set.
+    @return
+        Returns true if successful.
+    */
+    bool NotificationQueue::setNotificationLength(int length)
+    {
+        if(length < 0)
+            return false;
+        this->notificationLength_ = length;
+        this->update();
+        return true;
+    }
+
+    /**
+    @brief
+        Sets the maximum number of seconds a Notification is displayed.
+    @param time
+        The number of seconds the Notifications is displayed.
+    @return
+        Returns true if successful.
+    */
+    bool NotificationQueue::setDisplayTime(int time)
+    {
+        if(time < 0)
+            return false;
+        this->displayTime_ = time;
+        this->update();
+        return true;
+    }
+
+    /**
+    @brief
+        Produces all targets concatinated as string, with kommas (',') as seperators.
+    @param string
+        Pointer to a string which will be used by the method to fill with the concatination of the targets.
+    @return
+        Returns true if successful.
+    */
+    bool NotificationQueue::getTargets(std::string* string) const
+    {
+        if(string == NULL)
+        {
+            COUT(4) << "Input string must have memory allocated." << std::endl;
+            return false;
+        }
+        string->clear();
+        bool first = true;
+        for(std::set<std::string>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); it++) //!< Iterate through the set of targets.
+        {
+            if(!first)
+            {
+                *string += ",";
+            }
+            else
+            {
+                first = false;
+            }
+            *string += *it;
+        }
+
+        return true;
+    }
+
+    /**
+    @brief
+        Sets the targets of the queue.
+        The targets are the senders whose Notifications are displayed in this queue.
+    @param targets
+        Accepts a string of targets, each seperated by commas (','), spaces are ignored.
+    @return
+        Returns true if successful.
+    */
+    bool NotificationQueue::setTargets(const std::string & targets)
+    {
+        this->targets_.clear();
+
+        std::string* pTemp;
+        unsigned int index = 0;
+        while( index < targets.size() ) //!< Go through the string, character by character until the end is reached.
+        {
+            pTemp = new std::string("");
+            while(index < targets.size() && targets[index] != ',' && targets[index] != ' ')
+            {
+                *pTemp += targets[index];
+                index++;
+            }
+            index++;
+            this->targets_.insert(*pTemp);
+        }
+
+        return true;
+    }
+
+    /**
+    @brief
+        Sets the font size.
+    @param size
+        The font size.
+    @return
+        Returns true if successful.
+    */
+    bool NotificationQueue::setFontSize(float size)
+    {
+        if(size <= 0)
+            return false;
+        this->fontSize_ = size;
+        for (std::map<Notification*, NotificationOverlayContainer*>::iterator it = this->overlays_.begin(); it != this->overlays_.end(); it++) //!< Set the font size for each overlay.
+        {
+            it->second->overlay->setFontSize(size);
+        }
+        return true;
+    }
+
+    /**
+    @brief
+        Sets the font.
+    @param font
+        The font.
+    @return
+        Returns true if successful.
+    */
+    bool NotificationQueue::setFont(const std::string & font)
+    {
+        this->font_ = font;
+        for (std::map<Notification*, NotificationOverlayContainer*>::iterator it = this->overlays_.begin(); it != this->overlays_.end(); it++) //!< Set the font for each overlay.
+        {
+            it->second->overlay->setFont(font);
+        }
+        return true;
+    }
+
+    /**
+    @brief
+        Scrolls the NotificationQueue, meaning all NotificationOverlays are moved the input vector.
+    @param pos
+        The vector the NotificationQueue is scrolled.
+    */
+    void NotificationQueue::scroll(const Vector2 pos)
+    {
+        for (std::map<Notification*, NotificationOverlayContainer*>::iterator it = this->overlays_.begin(); it != this->overlays_.end(); ++it) //!< Scroll each overlay.
+        {
+            it->second->overlay->scroll(pos);
+        }
+    }
+
+    /**
+    @brief
+        Aligns all the Notifications to the position of the NotificationQueue.
+    */
+    void NotificationQueue::positionChanged(void)
+    {
+        int counter = 0;
+        for (std::multiset<NotificationOverlayContainer*, NotificationOverlayContainerCompare>::iterator it = this->containers_.begin(); it != this->containers_.end(); it++) //!< Set the position for each overlay.
+        {
+            (*it)->overlay->setPosition(this->getPosition());
+            (*it)->overlay->scroll(Vector2(0.0,(1.1*this->getFontSize())*counter));
+            counter++;
+        }
+    }
+
+    /**
+    @brief
+        Adds a Notification, to the queue.
+        It inserts it into the storage containers, creates an corresponding overlay and a container.
+    @param notification
+        The Notification.
+    @param time
+        The time.
+    */
+    void NotificationQueue::addNotification(Notification* notification, const std::time_t & time)
+    {
+        NotificationOverlayContainer* container = new NotificationOverlayContainer;
+        container->overlay = new NotificationOverlay(this, notification);
+        container->notification = notification;
+        container->time = time;
+        std::string timeString = std::ctime(&time);
+        timeString.erase(timeString.length()-1);
+        std::ostringstream stream;
+        stream << reinterpret_cast<unsigned long>(notification);
+        std::string addressString = stream.str() ;
+        container->name = "NotificationOverlay(" + timeString + ")&" + addressString;
+
+        this->containers_.insert(container);
+        this->overlays_[notification] = container;
+        this->addElement(container->overlay);
+        this->size_= this->size_+1;
+
+        container->overlay->scroll(Vector2(0.0,(1.1*this->getFontSize())*(this->getSize()-1)));
+    }
+
+    /**
+    @brief
+        Removes a container from the queue.
+    @param container
+        A pointer to the container.
+    @return
+        Returns true if successful.
+    */
+    bool NotificationQueue::removeContainer(NotificationOverlayContainer* container)
+    {
+        if(this->size_ == 0) //!< You cannot remove anything if the queue is empty.
+            return false;
+
+        this->removeElement(container->overlay);
+        this->containers_.erase(container);
+        this->overlays_.erase(container->notification);
+        delete container->overlay;
+        delete container;
+        this->size_= this->size_-1;
+
+        return true;
+    }
+
+    /**
+    @brief
+        Clears the queue by removing all containers.
+    */
+    void NotificationQueue::clear(void)
+    {
+        std::multiset<NotificationOverlayContainer*, NotificationOverlayContainerCompare>::iterator it = this->containers_.begin();
+        while(it != this->containers_.end())
+        {
+            this->removeContainer(*it);
+            it = this->containers_.begin(); //TDO: Needed?
+        }
+    }
+
+}

Copied: code/branches/libraries/src/orxonox/objects/quest/notifications/NotificationQueue.h (from rev 5646, code/branches/libraries/src/orxonox/overlays/notifications/NotificationQueue.h)
===================================================================
--- code/branches/libraries/src/orxonox/objects/quest/notifications/NotificationQueue.h	                        (rev 0)
+++ code/branches/libraries/src/orxonox/objects/quest/notifications/NotificationQueue.h	2009-08-14 01:07:59 UTC (rev 5648)
@@ -0,0 +1,210 @@
+/*
+ *   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 NotificationQueue class.
+*/
+
+#ifndef _NotificationOueue_H__
+#define _NotificationOueue_H__
+
+#include "objects/quest/QuestPrereqs.h"
+
+#include <ctime>
+#include <map>
+#include <set>
+#include <string>
+
+#include "util/Math.h"
+#include "tools/interfaces/Tickable.h"
+#include "overlays/OverlayGroup.h"
+#include "interfaces/NotificationListener.h"
+
+namespace orxonox
+{
+
+    //! Container to allow easy handling.
+    struct NotificationOverlayContainer
+    {
+        NotificationOverlay* overlay; //!< Pointer to the NotificationOverlay, everything is about.
+        Notification* notification; //!< The Notification displayed by the overlay.
+        time_t time; //!< The time the Notification was sent and thus first displayed.
+        std::string name; //!< The name of the overlay.
+    };
+
+    //! Struct to allow ordering of NotificationOverlayContainers.
+    struct NotificationOverlayContainerCompare {
+        bool operator() (const NotificationOverlayContainer* const & a, const NotificationOverlayContainer* const & b) const
+            { return a->time < b->time; } //!< Ordered by time.
+    };
+
+    /**
+    @brief
+        Displays Notifications from specific senders.
+        Beware! The NotificationQueue is an OverlayGruop and thus cannot be be a sub-element of an OverlayGroup (at least no for now.)
+
+        Creating a NotificationQueue through XML goes as follows:
+        <NotificationQueue
+            name = "SuperQueue" //Name of your OverlayQueue.
+            maxSize = "5" //The maximum size of Notifications displayed.
+            notificationLength = "64" //The maximum number of characters of a Notification, that are displayed. (Default is 5)
+            displayTime = "30" //The time a Notification is displayed in seconds. (Default is 30)
+            targets = "target1, target2" //The senders this NotificationQueue displays Notifications from. (all, if all Notifications should be displayed.)
+            font = "VeraMono" //The font (Default is VeraMono)
+            fontSize = '0.4' //The font size. (Default is 0.025)
+            position = "0.0, .0.0" //The position of the NotificationQueue. (Default is 0.0,0.0)
+        />
+    @author
+        Damian 'Mozork' Frick
+    */
+
+    class _QuestExport NotificationQueue : public OverlayGroup, public Tickable, public NotificationListener
+    {
+
+        public:
+            NotificationQueue(BaseObject* creator);
+            virtual ~NotificationQueue();
+
+            virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode); //!< Method for creating a NotificationQueue object through XML.
+
+            virtual void tick(float dt); //!< To update from time to time.
+
+            void update(void); //!< Updates the queue.
+            void update(Notification* notification, const std::time_t & time); //!< Adds a Notification to the queue.
+
+            /**
+            @brief Returns the maximum number of Notifications displayed.
+            @return Returns maximum size.
+            */
+            inline int getMaxSize() const
+                { return this->maxSize_; }
+            /**
+            @brief Returns the current number of Notifications displayed.
+            @return Returns the size of the queue.
+            */
+            inline int getSize() const
+                { return this->size_; }
+            /**
+            @brief Returns the maximum length in characters a Notification message is allowed to have.
+            @return Returns the maximum Notification length.
+            */
+            inline int getNotificationLength() const
+                { return this->notificationLength_; }
+            /**
+            @brief Returns the time interval the Notification is displayed.
+            @return Returns the display time.
+            */
+            inline int getDisplayTime() const
+                { return this->displayTime_; }
+            /**
+            @brief Returns the position of the NotificationQueue.
+            @return Returns the position.
+            */
+            inline const Vector2 & getPosition() const
+                { return this->position_; }
+            /**
+            @brief Returns the font size used to display the Notifications.
+            @return  Returns the font size.
+            */
+            inline float getFontSize() const
+                { return this->fontSize_; }
+            /**
+            @brief Returns the font used to display the Notifications.
+            @return Returns the font.
+            */
+            inline const std::string & getFont() const
+                { return this->font_; }
+
+            /**
+            @brief Returns the targets of this queue, reps. the senders which Notifications are displayed in this queue.
+            @return Retuns a set of string holding the different targets.
+            */
+            inline const std::set<std::string> & getTargetsSet()
+                { return this->targets_; }
+            bool getTargets(std::string* string) const; //!< Returns a string consisting of the concatination of the targets.
+
+            /**
+            @brief Sets the position of the NotificationQueue.
+            @param pos The position.
+            */
+            inline void setPosition(Vector2 pos)
+                { this->position_ = pos; this->positionChanged(); }
+
+            void scroll(const Vector2 pos); //!< Scrolls the NotificationQueue, meaning all NotificationOverlays are moved the input vector.
+
+        private:
+            static const int DEFAULT_SIZE = 5; //!< The default maximum number of Notifications displayed.
+            static const int DEFAULT_LENGTH = 64; //!< The default maximum number of Notifications displayed.
+            static const int DEFAULT_DISPLAY_TIME = 30; //!< The default display time.
+            static const float DEFAULT_FONT_SIZE; //!< The default font size.
+
+            static const std::string DEFAULT_FONT; //!< The default font.
+            static const Vector2 DEFAULT_POSITION; //!< the default position.
+
+            int maxSize_; //!< The maximal number of Notifications displayed.
+            int size_; //!< The number of Notifications displayed.
+            int notificationLength_; //!< The maximal number of characters a Notification-message is allowed to have.
+            int displayTime_; //!< The time a Notification is displayed.
+            Vector2 position_; //!< The position of the NotificationQueue.
+
+            std::set<std::string> targets_; //!< The targets the Queue displays Notifications of.
+
+            float fontSize_; //!< The font size.
+            std::string font_; //!< The font.
+
+            std::multiset<NotificationOverlayContainer*, NotificationOverlayContainerCompare> containers_; //!< Multiset, because the ordering is based on, not necessarily unique, timestamps.
+            std::map<Notification*, NotificationOverlayContainer*> overlays_; //!< Mapping notifications to their corresponding overlay containers, for easier association and finding.
+
+            float tickTime_; //!< Helper variable, to not have to check for overlays that have been displayed too long, every tick.
+            NotificationOverlayContainer timeLimit_; //!< Helper object to check against to determine whether Notifications have expired.
+
+            void initialize(void); //!< Initializes the object.
+            void setDefaults(void); //!< Helper method to set the default values.
+
+            bool setMaxSize(int size); //!< Sets the maximum number of displayed Notifications.
+            bool setNotificationLength(int length); //!< Sets the maximum number of characters a Notification message displayed by this queue is allowed to have.
+            bool setDisplayTime(int time); //!< Sets the maximum number of seconds a Notification is displayed.
+
+            bool setTargets(const std::string & targets); //!< Set the targets of this queue.
+
+            bool setFontSize(float size); //!< Set the font size.
+            bool setFont(const std::string & font); //!< Set the font.
+
+            void positionChanged(void); //!< Aligns all the Notifications to the position of the NotificationQueue.
+
+            void addNotification(Notification* notification, const std::time_t & time); //!< Add a notification to the queue.
+            bool removeContainer(NotificationOverlayContainer* container); //!< Remove a container from the queue.
+
+            void clear(void); //!< Clear the queue.
+
+    };
+
+}
+
+#endif /* _NotificationOverlay_H__ */

Modified: code/branches/libraries/src/orxonox/overlays/CMakeLists.txt
===================================================================
--- code/branches/libraries/src/orxonox/overlays/CMakeLists.txt	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/overlays/CMakeLists.txt	2009-08-14 01:07:59 UTC (rev 5648)
@@ -11,7 +11,6 @@
 
 ADD_SUBDIRECTORY(debug)
 ADD_SUBDIRECTORY(hud)
-ADD_SUBDIRECTORY(notifications)
 ADD_SUBDIRECTORY(stats)
 
 ORXONOX_ADD_LIBRARY(overlays

Modified: code/branches/libraries/src/orxonox/overlays/GUIOverlay.cc
===================================================================
--- code/branches/libraries/src/orxonox/overlays/GUIOverlay.cc	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/overlays/GUIOverlay.cc	2009-08-14 01:07:59 UTC (rev 5648)
@@ -35,7 +35,6 @@
 #include "core/CoreIncludes.h"
 #include "core/GUIManager.h"
 #include "core/XMLPort.h"
-#include "objects/quest/QuestManager.h"
 #include "objects/infos/PlayerInfo.h"
 
 namespace orxonox
@@ -83,6 +82,6 @@
     void GUIOverlay::setGUIName(const std::string& name)
     {
         this->guiName_ = name;
-        QuestManager::getInstance().setPlayer(name, orxonox_cast<PlayerInfo*>(this->getOwner()));
+        GUIManager::getInstance().setPlayer(name, orxonox_cast<PlayerInfo*>(this->getOwner()));
     }
 }

Modified: code/branches/libraries/src/orxonox/overlays/OverlaysPrereqs.h
===================================================================
--- code/branches/libraries/src/orxonox/overlays/OverlaysPrereqs.h	2009-08-14 00:57:22 UTC (rev 5647)
+++ code/branches/libraries/src/orxonox/overlays/OverlaysPrereqs.h	2009-08-14 01:07:59 UTC (rev 5648)
@@ -71,11 +71,6 @@
     class HUDSpeedBar;
     class HUDHealthBar;
     class HUDTimer;
-    class Notification;
-    class NotificationListener;
-    class NotificationManager;
-    class NotificationOverlay;
-    class NotificationQueue;
     class OrxonoxOverlay;
     class OverlayGroup;
     class OverlayText;




More information about the Orxonox-commit mailing list