[Orxonox-commit 2650] r7355 - code/branches/notifications/src/modules/questsystem

dafrick at orxonox.net dafrick at orxonox.net
Sun Sep 5 13:29:07 CEST 2010


Author: dafrick
Date: 2010-09-05 13:29:07 +0200 (Sun, 05 Sep 2010)
New Revision: 7355

Modified:
   code/branches/notifications/src/modules/questsystem/Quest.cc
   code/branches/notifications/src/modules/questsystem/QuestDescription.cc
   code/branches/notifications/src/modules/questsystem/QuestDescription.h
   code/branches/notifications/src/modules/questsystem/QuestHint.cc
   code/branches/notifications/src/modules/questsystem/QuestNotification.cc
   code/branches/notifications/src/modules/questsystem/QuestNotification.h
Log:
Re-enabling Notifications for Quests.
Notifications still only work in standalone, though.


Modified: code/branches/notifications/src/modules/questsystem/Quest.cc
===================================================================
--- code/branches/notifications/src/modules/questsystem/Quest.cc	2010-09-05 10:42:54 UTC (rev 7354)
+++ code/branches/notifications/src/modules/questsystem/Quest.cc	2010-09-05 11:29:07 UTC (rev 7355)
@@ -366,7 +366,7 @@
 
         COUT(4) << "Quest {" << this->getId() << "} is failed for player: " << player << " ." <<std::endl;
 
-        this->getDescription()->sendFailQuestNotification();
+        this->getDescription()->sendFailQuestNotification(player);
         return true;
     }
 
@@ -385,7 +385,7 @@
 
         COUT(4) << "Quest {" << this->getId() << "} is completed for player: " << player << " ." <<std::endl;
 
-        this->getDescription()->sendCompleteQuestNotification();
+        this->getDescription()->sendCompleteQuestNotification(player);
         return true;
     }
 
@@ -411,7 +411,7 @@
 
         this->setStatus(player, QuestStatus::Active);
 
-        this->getDescription()->sendAddQuestNotification();
+        this->getDescription()->sendAddQuestNotification(player);
         return true;
     }
 

Modified: code/branches/notifications/src/modules/questsystem/QuestDescription.cc
===================================================================
--- code/branches/notifications/src/modules/questsystem/QuestDescription.cc	2010-09-05 10:42:54 UTC (rev 7354)
+++ code/branches/notifications/src/modules/questsystem/QuestDescription.cc	2010-09-05 11:29:07 UTC (rev 7355)
@@ -83,12 +83,12 @@
         The item the QuestDescription is for.
     @param status
         The status the QuestDescription us for.
+    @param player
+        The player the Notification is sent to.
     @return
         Returns true if successful.
-    @todo
-        Make sure the messages meet the conditions.
     */
-    bool QuestDescription::notificationHelper(const std::string & item, const std::string & status)
+    bool QuestDescription::notificationHelper(const std::string & item, const std::string & status, PlayerInfo* player)
     {
         std::string message;
         if(item == "hint")
@@ -122,7 +122,7 @@
         }
 
         QuestNotification* notification = new QuestNotification(this, message);
-        notification->send();
+        notification->send(player);
         return true;
     }
 

Modified: code/branches/notifications/src/modules/questsystem/QuestDescription.h
===================================================================
--- code/branches/notifications/src/modules/questsystem/QuestDescription.h	2010-09-05 10:42:54 UTC (rev 7354)
+++ code/branches/notifications/src/modules/questsystem/QuestDescription.h	2010-09-05 11:29:07 UTC (rev 7355)
@@ -94,31 +94,35 @@
 
             /**
             @brief Sends a Notification displaying that a QuestHint was added.
+            @param player The player the Notification is sent to.
             @return Returns true if successful.
             */
-            inline bool sendAddHintNotification(void)
-                { return notificationHelper("hint", ""); }
+            inline bool sendAddHintNotification(PlayerInfo* player)
+                { return notificationHelper("hint", "", player); }
 
             /**
             @brief Sends a Notification displaying that a Quest was added.
+            @param player The player the Notification is sent to.
             @return Returns true if successful.
             */
-            inline bool sendAddQuestNotification(void)
-                { return notificationHelper("quest", "start"); }
+            inline bool sendAddQuestNotification(PlayerInfo* player)
+                { return notificationHelper("quest", "start", player); }
 
             /**
             @brief Sends a Notification displaying that a Quest was failed.
+            @param player The player the Notification is sent to.
             @return Returns true if successful.
             */
-            inline bool sendFailQuestNotification(void)
-                { return notificationHelper("quest", "fail"); }
+            inline bool sendFailQuestNotification(PlayerInfo* player)
+                { return notificationHelper("quest", "fail", player); }
 
             /**
             @brief Sends a Notification displaying that a Quest was completed.
+            @param player The player the Notification is sent to.
             @return Returns true if successful.
             */
-            inline bool sendCompleteQuestNotification(void)
-                { return notificationHelper("quest", "complete"); }
+            inline bool sendCompleteQuestNotification(PlayerInfo* player)
+                { return notificationHelper("quest", "complete", player); }
 
         private:
             std::string title_; //!< The title.
@@ -126,7 +130,7 @@
             std::string failMessage_; //!< The message displayed when the Quest is failed.
             std::string completeMessage_; //!< The message displayed when the Quest is completed.
 
-            bool notificationHelper(const std::string & item, const std::string & status); //!< Helper for sending QuestDescriptions as Notifications.
+            bool notificationHelper(const std::string & item, const std::string & status, PlayerInfo* player); //!< Helper for sending QuestDescriptions as Notifications.
 
             /**
             @brief Sets the title.

Modified: code/branches/notifications/src/modules/questsystem/QuestHint.cc
===================================================================
--- code/branches/notifications/src/modules/questsystem/QuestHint.cc	2010-09-05 10:42:54 UTC (rev 7354)
+++ code/branches/notifications/src/modules/questsystem/QuestHint.cc	2010-09-05 11:29:07 UTC (rev 7355)
@@ -120,7 +120,7 @@
             {
                 this->playerStatus_[player] = QuestHintStatus::Active;
 
-                this->getDescription()->sendAddHintNotification();
+                this->getDescription()->sendAddHintNotification(player);
                 return true;
             }
             else

Modified: code/branches/notifications/src/modules/questsystem/QuestNotification.cc
===================================================================
--- code/branches/notifications/src/modules/questsystem/QuestNotification.cc	2010-09-05 10:42:54 UTC (rev 7354)
+++ code/branches/notifications/src/modules/questsystem/QuestNotification.cc	2010-09-05 11:29:07 UTC (rev 7355)
@@ -28,6 +28,7 @@
 
 #include "QuestNotification.h"
 #include "core/CoreIncludes.h"
+#include "infos/PlayerInfo.h"
 
 namespace orxonox {
 
@@ -67,12 +68,14 @@
     /**
     @brief
         Send the QuestNotification.
+    @param player
+        The player the Notification is sent to.
     @return
         Returns true if successful.
     */
-    bool QuestNotification::send(void)
+    bool QuestNotification::send(PlayerInfo* player)
     {
-        return true;//this->Notification::send(QuestNotification::SENDER); //TODO: Adjust.
+        return this->Notification::send(player->getClientID(), QuestNotification::SENDER);
     }
 
 

Modified: code/branches/notifications/src/modules/questsystem/QuestNotification.h
===================================================================
--- code/branches/notifications/src/modules/questsystem/QuestNotification.h	2010-09-05 10:42:54 UTC (rev 7354)
+++ code/branches/notifications/src/modules/questsystem/QuestNotification.h	2010-09-05 11:29:07 UTC (rev 7355)
@@ -49,7 +49,7 @@
             QuestNotification(BaseObject* creator, const std::string & message); //!< Constructor.
             virtual ~QuestNotification(); //!< Destructor.
 
-            bool send(void); //!< Send the QuestNotification.
+            bool send(PlayerInfo* player); //!< Send the QuestNotification.
 
         private:
             static const std::string SENDER; //!< A string identifying the questsystem as the sender.




More information about the Orxonox-commit mailing list