Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 5, 2010, 1:29:07 PM (14 years ago)
Author:
dafrick
Message:

Re-enabling Notifications for Quests.
Notifications still only work in standalone, though.

Location:
code/branches/notifications/src/modules/questsystem
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/notifications/src/modules/questsystem/Quest.cc

    r7163 r7355  
    367367        COUT(4) << "Quest {" << this->getId() << "} is failed for player: " << player << " ." <<std::endl;
    368368
    369         this->getDescription()->sendFailQuestNotification();
     369        this->getDescription()->sendFailQuestNotification(player);
    370370        return true;
    371371    }
     
    386386        COUT(4) << "Quest {" << this->getId() << "} is completed for player: " << player << " ." <<std::endl;
    387387
    388         this->getDescription()->sendCompleteQuestNotification();
     388        this->getDescription()->sendCompleteQuestNotification(player);
    389389        return true;
    390390    }
     
    412412        this->setStatus(player, QuestStatus::Active);
    413413
    414         this->getDescription()->sendAddQuestNotification();
     414        this->getDescription()->sendAddQuestNotification(player);
    415415        return true;
    416416    }
  • code/branches/notifications/src/modules/questsystem/QuestDescription.cc

    r7163 r7355  
    8484    @param status
    8585        The status the QuestDescription us for.
     86    @param player
     87        The player the Notification is sent to.
    8688    @return
    8789        Returns true if successful.
    88     @todo
    89         Make sure the messages meet the conditions.
    9090    */
    91     bool QuestDescription::notificationHelper(const std::string & item, const std::string & status)
     91    bool QuestDescription::notificationHelper(const std::string & item, const std::string & status, PlayerInfo* player)
    9292    {
    9393        std::string message;
     
    123123
    124124        QuestNotification* notification = new QuestNotification(this, message);
    125         notification->send();
     125        notification->send(player);
    126126        return true;
    127127    }
  • code/branches/notifications/src/modules/questsystem/QuestDescription.h

    r7163 r7355  
    9595            /**
    9696            @brief Sends a Notification displaying that a QuestHint was added.
     97            @param player The player the Notification is sent to.
    9798            @return Returns true if successful.
    9899            */
    99             inline bool sendAddHintNotification(void)
    100                 { return notificationHelper("hint", ""); }
     100            inline bool sendAddHintNotification(PlayerInfo* player)
     101                { return notificationHelper("hint", "", player); }
    101102
    102103            /**
    103104            @brief Sends a Notification displaying that a Quest was added.
     105            @param player The player the Notification is sent to.
    104106            @return Returns true if successful.
    105107            */
    106             inline bool sendAddQuestNotification(void)
    107                 { return notificationHelper("quest", "start"); }
     108            inline bool sendAddQuestNotification(PlayerInfo* player)
     109                { return notificationHelper("quest", "start", player); }
    108110
    109111            /**
    110112            @brief Sends a Notification displaying that a Quest was failed.
     113            @param player The player the Notification is sent to.
    111114            @return Returns true if successful.
    112115            */
    113             inline bool sendFailQuestNotification(void)
    114                 { return notificationHelper("quest", "fail"); }
     116            inline bool sendFailQuestNotification(PlayerInfo* player)
     117                { return notificationHelper("quest", "fail", player); }
    115118
    116119            /**
    117120            @brief Sends a Notification displaying that a Quest was completed.
     121            @param player The player the Notification is sent to.
    118122            @return Returns true if successful.
    119123            */
    120             inline bool sendCompleteQuestNotification(void)
    121                 { return notificationHelper("quest", "complete"); }
     124            inline bool sendCompleteQuestNotification(PlayerInfo* player)
     125                { return notificationHelper("quest", "complete", player); }
    122126
    123127        private:
     
    127131            std::string completeMessage_; //!< The message displayed when the Quest is completed.
    128132
    129             bool notificationHelper(const std::string & item, const std::string & status); //!< Helper for sending QuestDescriptions as Notifications.
     133            bool notificationHelper(const std::string & item, const std::string & status, PlayerInfo* player); //!< Helper for sending QuestDescriptions as Notifications.
    130134
    131135            /**
  • code/branches/notifications/src/modules/questsystem/QuestHint.cc

    r7163 r7355  
    121121                this->playerStatus_[player] = QuestHintStatus::Active;
    122122
    123                 this->getDescription()->sendAddHintNotification();
     123                this->getDescription()->sendAddHintNotification(player);
    124124                return true;
    125125            }
  • code/branches/notifications/src/modules/questsystem/QuestNotification.cc

    r7324 r7355  
    2929#include "QuestNotification.h"
    3030#include "core/CoreIncludes.h"
     31#include "infos/PlayerInfo.h"
    3132
    3233namespace orxonox {
     
    6869    @brief
    6970        Send the QuestNotification.
     71    @param player
     72        The player the Notification is sent to.
    7073    @return
    7174        Returns true if successful.
    7275    */
    73     bool QuestNotification::send(void)
     76    bool QuestNotification::send(PlayerInfo* player)
    7477    {
    75         return true;//this->Notification::send(QuestNotification::SENDER); //TODO: Adjust.
     78        return this->Notification::send(player->getClientID(), QuestNotification::SENDER);
    7679    }
    7780
  • code/branches/notifications/src/modules/questsystem/QuestNotification.h

    r7163 r7355  
    5050            virtual ~QuestNotification(); //!< Destructor.
    5151
    52             bool send(void); //!< Send the QuestNotification.
     52            bool send(PlayerInfo* player); //!< Send the QuestNotification.
    5353
    5454        private:
Note: See TracChangeset for help on using the changeset viewer.