[Orxonox-commit 89] r2786 - in branches/questsystem5/src/orxonox: gamestates objects/quest overlays/notifications

dafrick at orxonox.net dafrick at orxonox.net
Sun Mar 15 12:55:45 CET 2009


Author: dafrick
Date: 2009-03-15 11:55:45 +0000 (Sun, 15 Mar 2009)
New Revision: 2786

Modified:
   branches/questsystem5/src/orxonox/gamestates/GSLevel.cc
   branches/questsystem5/src/orxonox/gamestates/GSLevel.h
   branches/questsystem5/src/orxonox/objects/quest/QuestManager.cc
   branches/questsystem5/src/orxonox/objects/quest/QuestManager.h
   branches/questsystem5/src/orxonox/overlays/notifications/NotificationManager.cc
   branches/questsystem5/src/orxonox/overlays/notifications/NotificationManager.h
Log:
Some changes to QuestManager and NotificationManager by Reto's request. (Make them more consistent as Singletons)

Modified: branches/questsystem5/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- branches/questsystem5/src/orxonox/gamestates/GSLevel.cc	2009-03-15 10:41:25 UTC (rev 2785)
+++ branches/questsystem5/src/orxonox/gamestates/GSLevel.cc	2009-03-15 11:55:45 UTC (rev 2786)
@@ -45,6 +45,8 @@
 #include "CameraManager.h"
 #include "LevelManager.h"
 #include "PlayerManager.h"
+#include "objects/quest/QuestManager.h"
+#include "overlays/notifications/NotificationManager.h"
 
 namespace orxonox
 {
@@ -95,6 +97,10 @@
 
         this->playerManager_ = new PlayerManager();
 
+        this->questManager_ = new QuestManager();
+
+        this->notificationManager_ = new NotificationManager();
+
         if (Core::isMaster())
         {
             // create the global LevelManager

Modified: branches/questsystem5/src/orxonox/gamestates/GSLevel.h
===================================================================
--- branches/questsystem5/src/orxonox/gamestates/GSLevel.h	2009-03-15 10:41:25 UTC (rev 2785)
+++ branches/questsystem5/src/orxonox/gamestates/GSLevel.h	2009-03-15 11:55:45 UTC (rev 2786)
@@ -62,6 +62,8 @@
         CameraManager*        cameraManager_;
         LevelManager*         levelManager_;
         PlayerManager*        playerManager_;
+        QuestManager*          questManager_;
+        NotificationManager*  notificationManager_;
 
         //##### ConfigValues #####
         std::string           keyDetectorCallbackCode_;

Modified: branches/questsystem5/src/orxonox/objects/quest/QuestManager.cc
===================================================================
--- branches/questsystem5/src/orxonox/objects/quest/QuestManager.cc	2009-03-15 10:41:25 UTC (rev 2785)
+++ branches/questsystem5/src/orxonox/objects/quest/QuestManager.cc	2009-03-15 11:55:45 UTC (rev 2786)
@@ -55,6 +55,8 @@
     {
         RegisterRootObject(QuestManager);
 
+        assert(singletonRef_s == 0);
+        singletonRef_s = this;
     }
 
     /**
@@ -74,10 +76,7 @@
     */
     /*static*/ QuestManager & QuestManager::getInstance()
     {
-        if(singletonRef_s == NULL)
-        {
-            singletonRef_s = new QuestManager();
-        }
+        assert(singletonRef_s);
         return *singletonRef_s;
     }
 

Modified: branches/questsystem5/src/orxonox/objects/quest/QuestManager.h
===================================================================
--- branches/questsystem5/src/orxonox/objects/quest/QuestManager.h	2009-03-15 10:41:25 UTC (rev 2785)
+++ branches/questsystem5/src/orxonox/objects/quest/QuestManager.h	2009-03-15 11:55:45 UTC (rev 2786)
@@ -52,11 +52,8 @@
     */
     class _OrxonoxExport QuestManager : public BaseObject
     {
-
-        protected:
-            QuestManager();
-
         public:
+            QuestManager();
             virtual ~QuestManager();
 
             static QuestManager& getInstance(); //!< Returns a reference to the single instance of the Quest Manager.

Modified: branches/questsystem5/src/orxonox/overlays/notifications/NotificationManager.cc
===================================================================
--- branches/questsystem5/src/orxonox/overlays/notifications/NotificationManager.cc	2009-03-15 10:41:25 UTC (rev 2785)
+++ branches/questsystem5/src/orxonox/overlays/notifications/NotificationManager.cc	2009-03-15 11:55:45 UTC (rev 2786)
@@ -57,6 +57,9 @@
     {
         RegisterRootObject(NotificationManager);
 
+        assert(singletonRef_s == 0);
+        singletonRef_s = this;
+
         this->highestIndex_ = 0;
     }
 
@@ -76,10 +79,7 @@
     */
     /*static*/ NotificationManager & NotificationManager::getInstance()
     {
-        if(singletonRef_s == NULL)
-        {
-            singletonRef_s = new NotificationManager();
-        }
+        assert(singletonRef_s);
         return *singletonRef_s;
     }
     

Modified: branches/questsystem5/src/orxonox/overlays/notifications/NotificationManager.h
===================================================================
--- branches/questsystem5/src/orxonox/overlays/notifications/NotificationManager.h	2009-03-15 10:41:25 UTC (rev 2785)
+++ branches/questsystem5/src/orxonox/overlays/notifications/NotificationManager.h	2009-03-15 11:55:45 UTC (rev 2786)
@@ -56,10 +56,8 @@
     */
     class _OrxonoxExport NotificationManager : public BaseObject
     {
-        protected:
-            NotificationManager();
-
         public:
+            NotificationManager();
             virtual ~NotificationManager();
 	        
             static const std::string ALL;




More information about the Orxonox-commit mailing list