Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 8, 2009, 1:36:05 AM (15 years ago)
Author:
landauf
Message:

reverted r2909 because there were some unwanted files included

Location:
code/trunk/src/orxonox/objects/quest
Files:
2 deleted
35 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/objects/quest/AddQuest.cc

    r2909 r2910  
    2828
    2929/**
    30     @file AddQuest.cc
     30    @file
    3131    @brief Implementation of the AddQuest class.
    3232*/
     
    4242#include "orxonox/objects/infos/PlayerInfo.h"
    4343#include "QuestManager.h"
    44 #include "QuestDescription.h"
    4544#include "Quest.h"
    4645
     
    9796        try
    9897        {
    99             Quest* quest = QuestManager::getInstance().findQuest(this->getQuestId());
     98            Quest* quest = QuestManager::findQuest(this->getQuestId());
    10099            if(quest == NULL || !quest->start(player))
    101100            {
  • code/trunk/src/orxonox/objects/quest/AddQuest.h

    r2909 r2910  
    2828
    2929/**
    30     @file AddQuest.h
     30    @file
    3131    @brief Definition of the AddQuest class.
    3232*/
  • code/trunk/src/orxonox/objects/quest/AddQuestHint.cc

    r2909 r2910  
    2828
    2929/**
    30     @file AddQuestHint.cc
     30    @file
    3131    @brief Implementation of the AddQuestHint class.
    3232*/
     
    117117        try
    118118        {
    119             QuestHint* hint = QuestManager::getInstance().findHint(this->hintId_);
     119            QuestHint* hint = QuestManager::findHint(this->hintId_);
    120120            if(hint == NULL || !hint->setActive(player))
    121121            {
  • code/trunk/src/orxonox/objects/quest/AddQuestHint.h

    r2909 r2910  
    2828
    2929/**
    30     @file AddQuestHint.h
     30    @file
    3131    @brief Definition of the AddQuestHint class.
    3232*/
  • code/trunk/src/orxonox/objects/quest/AddReward.cc

    r2909 r2910  
    2828
    2929/**
    30     @file AddReward.cc
     30    @file
    3131    @brief Implementation of the AddReward class.
    3232*/
  • code/trunk/src/orxonox/objects/quest/AddReward.h

    r2909 r2910  
    2828
    2929/**
    30     @file AddReward.h
     30    @file
    3131    @brief Definition of the AddReward class.
    3232*/
  • code/trunk/src/orxonox/objects/quest/CMakeLists.txt

    r2909 r2910  
    1616  QuestListener.cc
    1717  QuestManager.cc
    18   QuestNotification.cc
    1918  Rewardable.cc
    2019)
  • code/trunk/src/orxonox/objects/quest/ChangeQuestStatus.cc

    r2909 r2910  
    2828
    2929/**
    30     @file ChangeQuestStatus.cc
     30    @file
    3131    @brief Implementation of the ChangeQuestStatus class.
    3232*/
  • code/trunk/src/orxonox/objects/quest/ChangeQuestStatus.h

    r2909 r2910  
    2828
    2929/**
    30     @file ChangeQuestStatus.h
     30    @file
    3131    @brief Definition of the ChangeQuestStatus class.
    3232*/
  • code/trunk/src/orxonox/objects/quest/CompleteQuest.cc

    r2909 r2910  
    2828 
    2929/**
    30     @file CompleteQuest.cc
     30    @file
    3131    @brief Implementation of the CompleteQuest class.
    3232*/
     
    9696        try
    9797        {
    98             quest = QuestManager::getInstance().findQuest(this->getQuestId());
     98            quest = QuestManager::findQuest(this->getQuestId());
    9999            if(quest == NULL || !quest->complete(player))
    100100            {
  • code/trunk/src/orxonox/objects/quest/CompleteQuest.h

    r2909 r2910  
    2828
    2929/**
    30     @file CompleteQuest.h
     30    @file
    3131    @brief Definition of the CompleteQuest class.
    3232*/
  • code/trunk/src/orxonox/objects/quest/FailQuest.cc

    r2909 r2910  
    2828 
    2929/**
    30     @file FailQuest.cc
     30    @file
    3131    @brief Implementation of the FailQuest class.
    3232*/
     
    9595        try
    9696        {
    97             quest = QuestManager::getInstance().findQuest(this->getQuestId());
     97            quest = QuestManager::findQuest(this->getQuestId());
    9898            if(quest == NULL || !quest->fail(player))
    9999            {
  • code/trunk/src/orxonox/objects/quest/FailQuest.h

    r2909 r2910  
    2828
    2929/**
    30     @file FailQuest.h
     30    @file
    3131    @brief Definition of the FailQuest class.
    3232*/
  • code/trunk/src/orxonox/objects/quest/GlobalQuest.cc

    r2909 r2910  
    2828 
    2929/**
    30     @file GlobalQuest.cc
     30    @file
    3131    @brief Implementation of the GlobalQuest class.
    3232*/
  • code/trunk/src/orxonox/objects/quest/GlobalQuest.h

    r2909 r2910  
    2828 
    2929/**
    30     @file GlobalQuest.h
     30    @file
    3131    @brief Definition of the GlobalQuest class.
    3232*/
  • code/trunk/src/orxonox/objects/quest/LocalQuest.cc

    r2909 r2910  
    2828
    2929/**
    30     @file LocalQuest.cc
     30    @file
    3131    @brief Implementation of the LocalQuest class.
    3232*/
  • code/trunk/src/orxonox/objects/quest/LocalQuest.h

    r2909 r2910  
    2828 
    2929/**
    30     @file LocalQuest.h
     30    @file
    3131    @brief Definition of the LocalQuest class.
    3232*/
  • code/trunk/src/orxonox/objects/quest/Quest.cc

    r2909 r2910  
    2828 
    2929/**
    30     @file Quest.cc
     30    @file
    3131    @brief Implementation of the Quest class.
    3232*/
     
    7979        XMLPortObject(Quest, QuestEffect, "complete-effects", addCompleteEffect, getCompleteEffect, xmlelement, mode);
    8080
    81         QuestManager::getInstance().registerQuest(this); //!<Registers the Quest with the QuestManager.
     81        QuestManager::registerQuest(this); //!<Registers the Quest with the QuestManager.
    8282    }
    8383
  • code/trunk/src/orxonox/objects/quest/Quest.h

    r2909 r2910  
    2828 
    2929/**
    30     @file Quest.h
     30    @file
    3131    @brief Definition of the Quest class.
    3232        The Quest is the parent class of LocalQuest and GlobalQuest.
  • code/trunk/src/orxonox/objects/quest/QuestDescription.cc

    r2909 r2910  
    2828
    2929/**
    30     @file QuestDescription.cc
     30    @file
    3131    @brief Implementation of the QuestDescription class.
    3232*/
     
    3737
    3838#include "core/CoreIncludes.h"
    39 #include "QuestNotification.h"
     39#include "orxonox/overlays/notifications/Notification.h"
    4040
    4141namespace orxonox
     
    8989    @return
    9090        Returns true if successful.
    91     @todo
    92         Make sure the messages meet the conditions.
    9391    */
    9492    bool QuestDescription::notificationHelper(const std::string & item, const std::string & status) const
    9593    {
    9694        std::string message = "";
     95        std::string title = "";
    9796        if(item == "hint")
    9897        {
    99             message = "You received a hint: '" + this->title_ + "'";
     98            title = "You received a hint: '" + this->title_ + "'";
     99            message = this->description_;
    100100        }
    101101        else if(item == "quest")
     
    103103            if(status == "start")
    104104            {
    105                 message = "You received a new quest: '" + this->title_ + "'";
     105                title = "You received a new quest: '" + this->title_ + "'";
     106                message = this->description_;
    106107            }
    107108            else if(status == "fail")
    108109            {
    109                 message = "You failed the quest: '" + this->title_ + "'";
     110                title = "You failed the quest: '" + this->title_ + "'";
     111                message = this->failMessage_;
    110112            }
    111113            else if(status == "complete")
    112114            {
    113                 message = "You successfully completed the quest: '" + this->title_ + "'";
     115                title = "You successfully completed the quest: '" + this->title_ + "'";
     116                message = this->completeMessage_;
    114117            }
    115118            else
     
    125128        }
    126129       
    127         QuestNotification* notification = new QuestNotification(message);
     130        Notification* notification = new Notification(0, message, title, 30);
    128131        notification->send();
    129132        return true;
  • code/trunk/src/orxonox/objects/quest/QuestDescription.h

    r2909 r2910  
    2828
    2929/**
    30     @file QuestDescription.h
     30    @file
    3131    @brief Definition of the QuestDescription class.
    3232*/
  • code/trunk/src/orxonox/objects/quest/QuestEffect.cc

    r2909 r2910  
    2828
    2929/**
    30     @file QuestEffect.cc
     30    @file
    3131    @brief Implementation of the QuestEffect class.
    3232*/
  • code/trunk/src/orxonox/objects/quest/QuestEffect.h

    r2909 r2910  
    2828 
    2929/**
    30     @file QuestEffect.h
     30    @file
    3131    @brief Definition of the QuestEffect class.
    3232*/
  • code/trunk/src/orxonox/objects/quest/QuestEffectBeacon.cc

    r2909 r2910  
    2828
    2929/**
    30     @file QuestEffectBeacon.cc
     30    @file
    3131    @brief Implementation of the QuestEffectBeacon class.
    3232*/
  • code/trunk/src/orxonox/objects/quest/QuestEffectBeacon.h

    r2909 r2910  
    2828
    2929/**
    30     @file QuestEffectBeacon.h
     30    @file
    3131    @brief Definition of the QuestEffectBeacon class.
    3232*/
  • code/trunk/src/orxonox/objects/quest/QuestHint.cc

    r2909 r2910  
    2828 
    2929/**
    30     @file QuestHint.cc
     30    @file
    3131    @brief Implementation of the QuestHint class.
    3232*/
     
    7373        SUPER(QuestHint, XMLPort, xmlelement, mode);
    7474
    75         QuestManager::getInstance().registerHint(this); //!< Registers the QuestHint with the QuestManager.
     75        QuestManager::registerHint(this); //!< Registers the QuestHint with the QuestManager.
    7676       
    7777        COUT(3) << "New QuestHint {" << this->getId() << "} created." << std::endl;
  • code/trunk/src/orxonox/objects/quest/QuestHint.h

    r2909 r2910  
    2828 
    2929/**
    30     @file QuestHint.h
     30    @file
    3131    @brief Definition of the QuestHint class.
    3232*/
  • code/trunk/src/orxonox/objects/quest/QuestItem.cc

    r2909 r2910  
    2828 
    2929/**
    30     @file QuestItem.cc
     30    @file
    3131    @brief Implementation of the QuestItem class.
    3232*/
  • code/trunk/src/orxonox/objects/quest/QuestItem.h

    r2909 r2910  
    2828 
    2929/**
    30     @file QuestItem.h
     30    @file
    3131    @brief Definition of the QuestItem class.
    3232        The QuestItem is the parent class of Quest and QuestHint.
  • code/trunk/src/orxonox/objects/quest/QuestListener.cc

    r2909 r2910  
    2828
    2929/**
    30     @file QuestListener.cc
     30    @file
    3131    @brief Implementation of the QuestListener class.
    3232*/
     
    112112    bool QuestListener::setQuestId(const std::string & id)
    113113    {
    114         this->quest_ = QuestManager::getInstance().findQuest(id); //!< Find the Quest corresponding to the given questId.
     114        this->quest_ = QuestManager::findQuest(id); //!< Find the Quest corresponding to the given questId.
    115115       
    116116        if(this->quest_ == NULL) //!< If there is no such Quest.
  • code/trunk/src/orxonox/objects/quest/QuestListener.h

    r2909 r2910  
    2828
    2929/**
    30     @file QuestListener.h
     30    @file
    3131    @brief Definition of the QuestListener class.
    3232*/
  • code/trunk/src/orxonox/objects/quest/QuestManager.cc

    r2909 r2910  
    2828
    2929/**
    30     @file QuestManager.cc
     30    @file
    3131    @brief Implementation of the QuestManager class.
    3232*/
     
    4343namespace orxonox
    4444{
    45     //! Pointer to the current (and single) instance of this class.
    46     QuestManager* QuestManager::singletonRef_s = NULL;
     45    //! All Quests registered by their id's.
     46    std::map<std::string, Quest*> QuestManager::questMap_s;
     47    //! All QuestHints registered by their id's.
     48    std::map<std::string, QuestHint*> QuestManager::hintMap_s;
    4749
    4850    /**
    4951    @brief
    5052        Constructor. Registers the object.
    51     @todo
    52         Is inheriting from BaseObject proper?
    53     */
    54     QuestManager::QuestManager()
    55     {
    56         RegisterRootObject(QuestManager);
    57 
    58         assert(singletonRef_s == 0);
    59         singletonRef_s = this;
     53    */
     54    QuestManager::QuestManager(BaseObject* creator) : BaseObject(creator)
     55    {
     56        RegisterObject(QuestManager);
    6057    }
    6158
     
    6764    {
    6865
    69     }
    70 
    71     /**
    72     @brief
    73         Returns a reference to the current (and single) instance of the QuestManager, and creates one if there isn't one to begin with.
    74     @return
    75         Returns a reference to the single instance of the Quest Manager.
    76     */
    77     /*static*/ QuestManager & QuestManager::getInstance()
    78     {
    79         assert(singletonRef_s);
    80         return *singletonRef_s;
    8166    }
    8267
     
    9075        Returns true if successful, false if not.
    9176    */
    92     bool QuestManager::registerQuest(Quest* quest)
     77    /*static*/ bool QuestManager::registerQuest(Quest* quest)
    9378    {
    9479        if(quest == NULL) //!< Doh! Just as if there were actual quests behind NULL-pointers.
     
    9984
    10085        std::pair<std::map<std::string, Quest*>::iterator,bool> result;
    101         result = this->questMap_.insert( std::pair<std::string,Quest*>(quest->getId(),quest) ); //!< Inserting the Quest.
     86        result = questMap_s.insert( std::pair<std::string,Quest*>(quest->getId(),quest) ); //!< Inserting the Quest.
    10287
    10388        if(result.second) //!< If inserting was a success.
     
    122107        Returns true if successful, false if not.
    123108    */
    124     bool QuestManager::registerHint(QuestHint* hint)
     109    /*static*/ bool QuestManager::registerHint(QuestHint* hint)
    125110    {
    126111        if(hint == NULL) //!< Still not liking NULL-pointers.
     
    131116
    132117        std::pair<std::map<std::string, QuestHint*>::iterator,bool> result;
    133         result = this->hintMap_.insert ( std::pair<std::string,QuestHint*>(hint->getId(),hint) ); //!< Inserting the QuestHSint.
     118        result = hintMap_s.insert ( std::pair<std::string,QuestHint*>(hint->getId(),hint) ); //!< Inserting the QuestHSint.
    134119
    135120        if(result.second) //!< If inserting was a success.
     
    156141        Throws an exception if the given questId is invalid.
    157142    */
    158     Quest* QuestManager::findQuest(const std::string & questId)
     143    /*static*/ Quest* QuestManager::findQuest(const std::string & questId)
    159144    {
    160145        if(!QuestItem::isId(questId)) //!< Check vor validity of the given id.
     
    164149
    165150        Quest* quest;
    166         std::map<std::string, Quest*>::iterator it = this->questMap_.find(questId);
    167         if (it != this->questMap_.end()) //!< If the Quest is registered.
     151        std::map<std::string, Quest*>::iterator it = questMap_s.find(questId);
     152        if (it != questMap_s.end()) //!< If the Quest is registered.
    168153        {
    169154            quest = it->second;
     
    190175        Throws an exception if the given hintId is invalid.
    191176    */
    192     QuestHint* QuestManager::findHint(const std::string & hintId)
     177    /*static*/ QuestHint* QuestManager::findHint(const std::string & hintId)
    193178    {
    194179        if(!QuestItem::isId(hintId)) //!< Check vor validity of the given id.
     
    198183
    199184        QuestHint* hint;
    200         std::map<std::string, QuestHint*>::iterator it = this->hintMap_.find(hintId);
    201         if (it != this->hintMap_.end()) //!< If the QuestHint is registered.
     185        std::map<std::string, QuestHint*>::iterator it = hintMap_s.find(hintId);
     186        if (it != hintMap_s.end()) //!< If the QuestHint is registered.
    202187        {
    203188            hint = it->second;
  • code/trunk/src/orxonox/objects/quest/QuestManager.h

    r2909 r2910  
    2828
    2929/**
    30     @file QuestManager.h
     30    @file
    3131    @brief Definition of the QuestManager class.
    3232*/
     
    4040#include <string>
    4141
    42 #include "core/OrxonoxClass.h"
     42#include "core/BaseObject.h"
    4343
    4444namespace orxonox
     
    4646    /**
    4747    @brief
    48         Is a Singleton and manages Quests, by registering every Quest/QuestHint (through registerX()) and making them globally accessable (through findX()).
     48        Is a static class and manages Quests, by registering every Quest/QuestHint (through registerX()) and making them globally accessable (through findX()).
    4949        Quests (and QuestHints) are registered in the QuestManager with their id, and can be accessed in the same way.
    5050    @author
    5151        Damian 'Mozork' Frick
    5252    */
    53     class _OrxonoxExport QuestManager : public OrxonoxClass
     53    class _OrxonoxExport QuestManager : public BaseObject
    5454    {
     55
    5556        public:
    56             QuestManager();
     57            QuestManager(BaseObject* creator);
    5758            virtual ~QuestManager();
    5859
    59             static QuestManager& getInstance(); //!< Returns a reference to the single instance of the Quest Manager.
     60            static bool registerQuest(Quest* quest); //!< Registers a Quest in the QuestManager.
     61            static bool registerHint(QuestHint* quest); //!< Registers a QuestHint in the QuestManager.
    6062
    61             bool registerQuest(Quest* quest); //!< Registers a Quest in the QuestManager.
    62             bool registerHint(QuestHint* quest); //!< Registers a QuestHint in the QuestManager.
    63 
    64             Quest* findQuest(const std::string & questId); //!< Returns the Quest with the input id.
    65             QuestHint* findHint(const std::string & hintId); //!< Returns the QuestHint with the input id.
     63            static Quest* findQuest(const std::string & questId); //!< Returns the Quest with the input id.
     64            static QuestHint* findHint(const std::string & hintId); //!< Returns the QuestHint with the input id.
    6665
    6766        private:
    68             static QuestManager* singletonRef_s;
    69 
    70             std::map<std::string, Quest*> questMap_; //!< All Quests registered by their id's.
    71             std::map<std::string, QuestHint*> hintMap_; //!< All QuestHints registered by their id's.
     67            static std::map<std::string, Quest*> questMap_s; //!< All Quests registered by their id's.
     68            static std::map<std::string, QuestHint*> hintMap_s; //!< All QuestHints registered by their id's.
    7269
    7370    };
  • code/trunk/src/orxonox/objects/quest/Rewardable.cc

    r2909 r2910  
    2828
    2929/**
    30     @file Rewardable.cc
     30    @file
    3131    @brief Implementation of the Rewardable class.
    3232*/
  • code/trunk/src/orxonox/objects/quest/Rewardable.h

    r2909 r2910  
    2828
    2929/**
    30     @file Rewardable.h
     30    @file
    3131    @brief Definition of the Rewardable class.
    3232*/
Note: See TracChangeset for help on using the changeset viewer.