Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2092


Ignore:
Timestamp:
Nov 1, 2008, 8:32:10 PM (15 years ago)
Author:
landauf
Message:
  • adopted quest classes to the new hierarchy (with a creator pointer)
  • added "RegisterObject(…)" in all constructors and "virtual" to all destructors
Location:
code/trunk/src/orxonox
Files:
31 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/CMakeLists.txt

    r2087 r2092  
    6868  objects/worldentities/ParticleSpawner.cc
    6969#  objects/worldentities/Backlight.cc
     70 
     71  objects/quest/AddQuest.cc
     72  objects/quest/AddQuestHint.cc
     73  objects/quest/AddReward.cc
     74  objects/quest/ChangeQuestStatus.cc
     75  objects/quest/CompleteQuest.cc
     76  objects/quest/FailQuest.cc
     77  objects/quest/GlobalQuest.cc
     78  objects/quest/LocalQuest.cc
     79  objects/quest/Quest.cc
     80  objects/quest/QuestDescription.cc
     81  objects/quest/QuestEffect.cc
     82  objects/quest/QuestHint.cc
     83  objects/quest/QuestItem.cc
     84  objects/quest/QuestManager.cc
     85  objects/quest/Rewardable.cc
    7086
    7187  objects/worldentities/triggers/Trigger.cc
  • code/trunk/src/orxonox/objects/quest/AddQuest.cc

    r2091 r2092  
    4141
    4242
    43     AddQuest::AddQuest() : ChangeQuestStatus()
     43    AddQuest::AddQuest(BaseObject* creator) : ChangeQuestStatus(creator)
    4444    {
    4545        RegisterObject(AddQuest);
    4646    }
    47    
     47
    4848    /**
    4949    @brief
    5050        Destructor.
    51     */ 
     51    */
    5252    AddQuest::~AddQuest()
    5353    {
    5454    }
    55    
     55
    5656    void AddQuest::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    5757    {
    5858        SUPER(AddQuest, XMLPort, xmlelement, mode);
    59        
     59
    6060    }
    61    
     61
    6262    /**
    6363    @brief
     
    7575            return false;
    7676        }
    77    
     77
    7878        try
    7979        {
     
    8989            return false;
    9090        }
    91        
     91
    9292        return true;
    9393    }
  • code/trunk/src/orxonox/objects/quest/AddQuest.h

    r2091 r2092  
    4848    {
    4949        public:
    50             AddQuest();
    51             ~AddQuest();
    52            
     50            AddQuest(BaseObject* creator);
     51            virtual ~AddQuest();
     52
    5353            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    54            
     54
    5555            virtual bool invoke(Player* player); //!< Invokes the effect.
    56    
     56
    5757    };
    5858
  • code/trunk/src/orxonox/objects/quest/AddQuestHint.cc

    r2091 r2092  
    3838    CreateFactory(AddQuestHint);
    3939
    40     AddQuestHint::AddQuestHint() : QuestEffect()
     40    AddQuestHint::AddQuestHint(BaseObject* creator) : QuestEffect(creator)
    4141    {
    42        
     42        RegisterObject(AddQuestHint);
    4343    }
    44    
     44
    4545    /**
    4646    @brief
     
    5050    {
    5151    }
    52    
     52
    5353    void AddQuestHint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    5454    {
    5555        SUPER(AddQuestHint, XMLPort, xmlelement, mode);
    56        
     56
    5757        XMLPortParam(AddQuestHint, "hintId", setHintId, getHintId, xmlelement, mode);
    58        
     58
    5959    }
    6060
     
    9898           return false;
    9999        }
    100        
     100
    101101        return true;
    102        
     102
    103103    }
    104104}
  • code/trunk/src/orxonox/objects/quest/AddQuestHint.h

    r2091 r2092  
    4747    {
    4848        public:
    49             AddQuestHint();
    50             ~AddQuestHint();
    51            
     49            AddQuestHint(BaseObject* creator);
     50            virtual ~AddQuestHint();
     51
    5252            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    53            
     53
    5454            virtual bool invoke(Player* player); //!< Invokes the effect.
    55            
     55
    5656        private:
    5757            std::string hintId_;
    58            
     58
    5959            inline const std::string & getHintId(void) const
    6060                { return this->hintId_; }
    6161            void setHintId(const std::string & id);
    62    
     62
    6363    };
    6464
  • code/trunk/src/orxonox/objects/quest/AddReward.cc

    r2091 r2092  
    3232
    3333namespace orxonox {
    34    
     34
    3535    CreateFactory(AddReward);
    36    
    37     AddReward::AddReward() : QuestEffect()
     36
     37    AddReward::AddReward(BaseObject* creator) : QuestEffect(creator)
    3838    {
     39        RegisterObject(AddReward);
     40
    3941        this->initialize();
    4042    }
    41    
     43
    4244    /**
    4345    @brief
     
    5153    {
    5254        SUPER(AddReward, XMLPort, xmlelement, mode);
    53        
     55
    5456        XMLPortObject(AddReward, Rewardable, "", addRewardable, getRewardables, xmlelement, mode);
    55        
     57
    5658    }
    5759
     
    6466        RegisterObject(AddReward);
    6567    }
    66    
     68
    6769    const Rewardable* AddReward::getRewardables(unsigned int index) const
    6870    {
     
    9496            check = check && (*reward)->reward(player);
    9597        }
    96        
     98
    9799        return check;
    98100    }
  • code/trunk/src/orxonox/objects/quest/AddReward.h

    r2091 r2092  
    4949    {
    5050        public:
    51             AddReward();
    52             ~AddReward();
    53            
     51            AddReward(BaseObject* creator);
     52            virtual ~AddReward();
     53
    5454            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    55            
     55
    5656            virtual bool invoke(Player* player); //!< Invokes the effect.
    57            
     57
    5858        private:
    5959            std::list<Rewardable*> rewards_;
    60        
     60
    6161            void initialize(void); //!< Initializes the object.
    62        
     62
    6363            inline void addRewardable(Rewardable* reward)
    6464                { this->rewards_.push_back(reward); }
    6565            const Rewardable* getRewardables(unsigned int index) const;
    66    
     66
    6767    };
    6868
  • code/trunk/src/orxonox/objects/quest/ChangeQuestStatus.cc

    r2091 r2092  
    3434namespace orxonox {
    3535
    36     ChangeQuestStatus::ChangeQuestStatus() : QuestEffect()
     36    ChangeQuestStatus::ChangeQuestStatus(BaseObject* creator) : QuestEffect(creator)
    3737    {
    3838        RegisterObject(ChangeQuestStatus);
     
    4646    {
    4747    }
    48    
     48
    4949    void ChangeQuestStatus::setQuestId(const std::string & id)
    5050    {
     
    5656        this->questId_ = id;
    5757    }
    58    
     58
    5959    void ChangeQuestStatus::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    6060    {
    6161        SUPER(ChangeQuestStatus, XMLPort, xmlelement, mode);
    62        
     62
    6363        XMLPortParam(ChangeQuestStatus, "questId", setQuestId, getQuestId, xmlelement, mode);
    6464    }
  • code/trunk/src/orxonox/objects/quest/ChangeQuestStatus.h

    r2091 r2092  
    4848    {
    4949        public:
    50             ChangeQuestStatus();
     50            ChangeQuestStatus(BaseObject* creator);
    5151            virtual ~ChangeQuestStatus();
    52            
     52
    5353            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    54            
     54
    5555            virtual bool invoke(Player* player) = 0; //!< Invokes the effect.
    56            
     56
    5757        protected:
    5858            inline const std::string & getQuestId(void) const //!< Returns the quest id.
    5959                { return this->questId_; }
    60        
     60
    6161            std::string questId_; //!< The id of the quest the status should be changed of.
    62            
     62
    6363        private:
    6464            void setQuestId(const std::string & id);
  • code/trunk/src/orxonox/objects/quest/CompleteQuest.cc

    r2091 r2092  
    3838    CreateFactory(CompleteQuest);
    3939
    40     CompleteQuest::CompleteQuest() : ChangeQuestStatus()
     40    CompleteQuest::CompleteQuest(BaseObject* creator) : ChangeQuestStatus(creator)
    4141    {
    4242        RegisterObject(CompleteQuest);
    4343    }
    44    
     44
    4545    /**
    4646    @brief
     
    5050    {
    5151    }
    52    
     52
    5353    void CompleteQuest::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    5454    {
    5555        SUPER(CompleteQuest, XMLPort, xmlelement, mode);
    5656    }
    57    
     57
    5858    /**
    5959    @brief
     
    7171            return false;
    7272        }
    73    
     73
    7474        try
    7575        {
     
    8585            return false;
    8686        }
    87        
     87
    8888        return true;
    8989    }
  • code/trunk/src/orxonox/objects/quest/CompleteQuest.h

    r2091 r2092  
    4848    {
    4949        public:
    50             CompleteQuest();
    51             ~CompleteQuest();
    52            
     50            CompleteQuest(BaseObject* creator);
     51            virtual ~CompleteQuest();
     52
    5353            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    54            
     54
    5555            virtual bool invoke(Player* player); //!< Invokes the effect.
    56    
     56
    5757    };
    5858
  • code/trunk/src/orxonox/objects/quest/FailQuest.cc

    r2091 r2092  
    3838    CreateFactory(FailQuest);
    3939
    40     FailQuest::FailQuest() : ChangeQuestStatus()
     40    FailQuest::FailQuest(BaseObject* creator) : ChangeQuestStatus(creator)
    4141    {
    4242        RegisterObject(FailQuest);
    4343    }
    44    
     44
    4545    /**
    4646    @brief
     
    5050    {
    5151    }
    52    
     52
    5353    void FailQuest::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    5454    {
    5555        SUPER(FailQuest, XMLPort, xmlelement, mode);
    5656    }
    57    
     57
    5858    /**
    5959    @brief
     
    7171            return false;
    7272        }
    73    
     73
    7474        try
    7575        {
     
    8585            return false;
    8686        }
    87        
     87
    8888        return true;
    8989    }
  • code/trunk/src/orxonox/objects/quest/FailQuest.h

    r2091 r2092  
    4848    {
    4949        public:
    50             FailQuest();
    51             ~FailQuest();
    52            
     50            FailQuest(BaseObject* creator);
     51            virtual ~FailQuest();
     52
    5353            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    54            
     54
    5555            virtual bool invoke(Player* player); //!< Invokes the effect.
    56    
     56
    5757    };
    5858
  • code/trunk/src/orxonox/objects/quest/GlobalQuest.cc

    r2091 r2092  
    4040        Constructor.
    4141    */
    42     GlobalQuest::GlobalQuest() : Quest()
     42    GlobalQuest::GlobalQuest(BaseObject* creator) : Quest(creator)
    4343    {
     44        RegisterObject(GlobalQuest);
     45
    4446        this->initialize();
    4547    }
    46    
     48
    4749    /**
    4850    @brief
     
    5153    GlobalQuest::~GlobalQuest()
    5254    {
    53        
     55
    5456    }
    55    
     57
    5658    void GlobalQuest::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    5759    {
     
    6062        COUT(3) << "New GlobalQuest {" << this->getId() << "} created." << std::endl;
    6163    }
    62    
     64
    6365    void GlobalQuest::initialize(void)
    6466    {
    6567        RegisterObject(GlobalQuest);
    6668    }
    67    
     69
    6870    /**
    6971    @brief
     
    8082        return this->isInactive(player) ||  this->isActive(player);
    8183    }
    82    
     84
    8385    /**
    8486    @brief
     
    9698
    9799    }
    98    
     100
    99101    /**
    100102    @brief
     
    126128            ThrowException(Argument, "The input Player* is NULL.");
    127129        }
    128        
     130
    129131        //TDO: Does this really work???
    130132        std::set<Player*>::const_iterator it = this->players_.find((Player*)(void*)player);
     
    139141
    140142    }
    141    
     143
    142144    /**
    143145    @brief
     
    157159            return false;
    158160        }
    159        
     161
    160162        std::set<Player*>::const_iterator it = this->players_.find(player);
    161163        if (it == this->players_.end()) //!< Player is not yet in the list.
  • code/trunk/src/orxonox/objects/quest/GlobalQuest.h

    r2091 r2092  
    4949    {
    5050        public:
    51             GlobalQuest();
    52             ~GlobalQuest();
    53            
     51            GlobalQuest(BaseObject* creator);
     52            virtual ~GlobalQuest();
     53
    5454            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    55            
     55
    5656        protected:
    5757            virtual bool isStartable(const Player* player) const; //!< Checks whether the quest can be started.
    5858            virtual bool isFailable(const Player* player) const; //!< Checks whether the quest can be failed.
    5959            virtual bool isCompletable(const Player* player) const; //!< Checks whether the quest can be completed.
    60        
     60
    6161            virtual questStatus::Enum getStatus(const Player* player) const; //!< Returns the status of the quest for a specific player.
    6262            virtual bool setStatus(Player* player, const questStatus::Enum & status); //!< Sets the status for a specific player.
    63            
     63
    6464        private:
    6565            std::set<Player*> players_; //!< The set of players which possess this quest.
    6666            questStatus::Enum status_; //!< The status of this quest.
    67            
     67
    6868            void initialize(void);
    69    
     69
    7070    };
    7171
  • code/trunk/src/orxonox/objects/quest/LocalQuest.cc

    r2091 r2092  
    3636    CreateFactory(LocalQuest);
    3737
    38     LocalQuest::LocalQuest() : Quest()
     38    LocalQuest::LocalQuest(BaseObject* creator) : Quest(creator)
    3939    {
     40        RegisterObject(LocalQuest);
     41
    4042        this->initialize();
    4143    }
    42    
     44
    4345    /**
    4446    @brief
     
    4749    LocalQuest::~LocalQuest()
    4850    {
    49        
     51
    5052    }
    51    
     53
    5254    void LocalQuest::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    5355    {
     
    5658        COUT(3) << "New LocalQuest {" << this->getId() << "} created." << std::endl;
    5759    }
    58    
     60
    5961    void LocalQuest::initialize(void)
    6062    {
    6163        RegisterObject(LocalQuest);
    6264    }
    63    
     65
    6466    /**
    6567    @brief
     
    7678        return this->isInactive(player);
    7779    }
    78    
     80
    7981    /**
    8082    @brief
     
    9193        return this->isActive(player);
    9294    }
    93    
     95
    9496    /**
    9597    @brief
     
    106108        return this->isActive(player);
    107109    }
    108    
     110
    109111    /**
    110112    @brief
     
    123125            ThrowException(Argument, "The input Player* is NULL.");
    124126        }
    125        
     127
    126128        std::map<Player*, questStatus::Enum>::const_iterator it = this->playerStatus_.find((Player*)(void*)player); //Thx. to x3n for the (Player*)(void*) 'hack'.
    127129        if (it != this->playerStatus_.end())
     
    131133        return questStatus::inactive;
    132134    }
    133    
     135
    134136    /**
    135137    @brief
  • code/trunk/src/orxonox/objects/quest/LocalQuest.h

    r2091 r2092  
    4949    {
    5050        public:
    51             LocalQuest();
    52             ~LocalQuest();
    53            
     51            LocalQuest(BaseObject* creator);
     52            virtual ~LocalQuest();
     53
    5454            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    55            
     55
    5656        protected:
    5757            virtual bool isStartable(const Player* player) const; //!< Checks whether the quest can be started.
    5858            virtual bool isFailable(const Player* player) const; //!< Checks whether the quest can be failed.
    5959            virtual bool isCompletable(const Player* player) const; //!< Checks whether the quest can be completed.
    60        
     60
    6161            virtual questStatus::Enum getStatus(const Player* player) const; //!< Returns the status of the quest for a specific player.
    6262            virtual bool setStatus(Player* player, const questStatus::Enum & status); //!< Sets the status for a specific player.
    63                
     63
    6464        private:
    6565            std::map<Player*, questStatus::Enum> playerStatus_; //!< List of the status for each player, with the Player-pointer as key.
    66            
     66
    6767            void initialize(void);
    68    
     68
    6969    };
    70    
     70
    7171
    7272}
  • code/trunk/src/orxonox/objects/quest/Quest.cc

    r2091 r2092  
    3434namespace orxonox {
    3535
    36     Quest::Quest() : QuestItem()
    37     {
     36    Quest::Quest(BaseObject* creator) : QuestItem(creator)
     37    {
     38        RegisterObject(Quest);
     39
    3840        this->initialize();
    3941    }
    40    
     42
    4143    /**
    4244    @brief
     
    4547    Quest::~Quest()
    4648    {
    47        
    48     }
    49    
     49
     50    }
     51
    5052    void Quest::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    5153    {
    5254        SUPER(Quest, XMLPort, xmlelement, mode);
    53        
     55
    5456        XMLPortObject(Quest, Quest, "", addSubQuest, getSubQuests, xmlelement, mode);
    5557        XMLPortObject(Quest, QuestHint, "", addHint, getHints, xmlelement, mode);
    5658        XMLPortObject(Quest, QuestEffect, "fail-effects", addFailEffect, getFailEffects, xmlelement, mode);
    5759        XMLPortObject(Quest, QuestEffect, "complete-effects", addCompleteEffect, getCompleteEffects, xmlelement, mode);
    58        
     60
    5961        QuestManager::registerQuest(this); //Registers the quest with the QuestManager.
    6062    }
    61    
     63
    6264    /**
    6365    @brief
     
    6769    {
    6870        RegisterObject(Quest);
    69        
     71
    7072        this->parentQuest_ = NULL;
    7173    }
     
    8688            return false;
    8789        }
    88        
     90
    8991        this->parentQuest_ = quest;
    90        
     92
    9193        COUT(3) << "Parent Quest {" << quest->getId() << "} was added to Quest {" << this->getId() << "}." << std::endl;
    9294        return true;
    9395    }
    94    
     96
    9597    /**
    9698    @brief
     
    108110            return false;
    109111        }
    110        
     112
    111113        quest->setParentQuest(this);
    112114        this->subQuests_.push_back(quest);
    113        
     115
    114116        COUT(3) << "Sub Quest {" << quest->getId() << "} was added to Quest {" << this->getId() << "}." << std::endl;
    115117        return true;
    116118    }
    117    
    118    
    119     /**
    120     @brief
    121         Adds a Hint to the list of hints 
     119
     120
     121    /**
     122    @brief
     123        Adds a Hint to the list of hints
    122124    @param hint
    123125        The hint that should be added to the list of hints.
     
    132134            return false;
    133135        }
    134        
     136
    135137        this->hints_.push_back(hint);
    136138        hint->setQuest(this);
    137        
     139
    138140        COUT(3) << "QuestHint {" << hint->getId() << "} was added to Quest {" << this->getId() << "}." << std::endl;
    139141        return true;
    140142    }
    141    
    142     /**
    143     @brief
    144        
     143
     144    /**
     145    @brief
     146
    145147    */
    146148    bool Quest::addFailEffect(QuestEffect* effect)
     
    151153            return false;
    152154        }
    153        
     155
    154156        this->failEffects_.push_back(effect);
    155        
     157
    156158        COUT(3) << "A FailEffect was added to Quest {" << this->getId() << "}." << std::endl;
    157159        return true;
    158160    }
    159    
    160     /**
    161     @brief
    162        
     161
     162    /**
     163    @brief
     164
    163165    */
    164166    bool Quest::addCompleteEffect(QuestEffect* effect)
     
    169171            return false;
    170172        }
    171        
     173
    172174        this->completeEffects_.push_back(effect);
    173        
     175
    174176        COUT(3) << "A CompleteEffect was added to Quest {" << this->getId() << "}." << std::endl;
    175177        return true;
    176178    }
    177    
    178     /**
    179     @brief
    180        
     179
     180    /**
     181    @brief
     182
    181183    */
    182184    const Quest* Quest::getParentQuest(void)
     
    184186        return this->parentQuest_;
    185187    }
    186    
    187     /**
    188     @brief
    189        
     188
     189    /**
     190    @brief
     191
    190192    */
    191193    const Quest* Quest::getSubQuests(unsigned int index) const
     
    202204        return NULL;
    203205    }
    204    
    205     /**
    206     @brief
    207        
     206
     207    /**
     208    @brief
     209
    208210    */
    209211    const QuestHint* Quest::getHints(unsigned int index) const
     
    220222        return NULL;
    221223    }
    222    
    223     /**
    224     @brief
    225        
     224
     225    /**
     226    @brief
     227
    226228    */
    227229    const QuestEffect* Quest::getFailEffects(unsigned int index) const
     
    238240        return NULL;
    239241    }
    240    
    241     /**
    242     @brief
    243        
     242
     243    /**
     244    @brief
     245
    244246    */
    245247    const QuestEffect* Quest::getCompleteEffects(unsigned int index) const
     
    256258        return NULL;
    257259    }
    258    
     260
    259261    /**
    260262    @brief
     
    271273        return this->getStatus(player) == questStatus::inactive;
    272274    }
    273    
     275
    274276    /**
    275277    @brief
     
    287289        return this->getStatus(player) == questStatus::active;
    288290    }
    289    
     291
    290292    /**
    291293    @brief
     
    302304        return this->getStatus(player) == questStatus::failed;
    303305    }
    304    
     306
    305307    /**
    306308    @brief
     
    317319        return this->getStatus(player) == questStatus::completed;
    318320    }
    319    
     321
    320322    /**
    321323    @brief
     
    336338        return false;
    337339    }
    338    
     340
    339341    /**
    340342    @brief
     
    356358        return false;
    357359    }
    358    
     360
    359361    /**
    360362    @brief
  • code/trunk/src/orxonox/objects/quest/Quest.h

    r2091 r2092  
    6767    {
    6868        public:
    69             Quest();
     69            Quest(BaseObject* creator);
    7070            virtual ~Quest();
    71            
     71
    7272            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    73    
     73
    7474            inline Quest* getParentQuest(void) const //!< Returns the parent quest of the quest.
    7575                { return this->parentQuest_; }
    7676            inline const std::list<Quest*> & getSubQuestList(void) const //!< Returns the list of sub quests.
    7777                { return this->subQuests_; }
    78            
     78
    7979            bool isInactive(const Player* player) const; //!< Returns true if the quest status for the specific player is 'inactive'.
    8080            bool isActive(const Player* player) const; //!< Returns true if the quest status for the specific player is 'active'.
    8181            bool isFailed(const Player* player) const; //!< Returns true if the quest status for the specific player is 'failed'.
    8282            bool isCompleted(const Player* player) const; //!< Returns true if the quest status for the specific player is 'completed'.
    83                
     83
    8484            bool start(Player* player); //!< Sets a quest to active.
    8585            bool fail(Player* player); //!< Fails the quest.
    8686            bool complete(Player* player); //!< Completes the quest.
    87            
     87
    8888        protected:
    8989            void initialize(void); //!< Initialized the object.
    90            
     90
    9191            virtual bool isStartable(const Player* player) const = 0; //!< Checks whether the quest can be started.
    9292            virtual bool isFailable(const Player* player) const = 0; //!< Checks whether the quest can be failed.
    9393            virtual bool isCompletable(const Player* player) const = 0; //!< Checks whether the quest can be completed.
    94            
     94
    9595            bool setParentQuest(Quest* quest); //!< Sets the parent quest of the quest.
    9696            bool addSubQuest(Quest* quest); //!< Adds a sub quest to the quest.
     
    9898            bool addFailEffect(QuestEffect* effect);
    9999            bool addCompleteEffect(QuestEffect* effect);
    100            
     100
    101101            const Quest* getParentQuest(void);
    102102            const Quest* getSubQuests(unsigned int index) const;
     
    104104            const QuestEffect* getFailEffects(unsigned int index) const;
    105105            const QuestEffect* getCompleteEffects(unsigned int index) const;
    106            
     106
    107107            virtual questStatus::Enum getStatus(const Player* player) const = 0; //!< Returns the status of the quest for a specific player.
    108108            virtual bool setStatus(Player* player, const questStatus::Enum & status) = 0; //!< Changes the status for a specific player.
    109            
     109
    110110            Quest* parentQuest_; //!< Pointer to the parent quest.
    111111            std::list<Quest*> subQuests_; //!< List of all the sub quests.
    112            
     112
    113113            std::list<QuestHint*> hints_; //!< A list of all the hints tied to this quest.
    114            
     114
    115115            std::list<QuestEffect*> failEffects_; //!< A list of all effects to be invoked, when the quest has been failed.
    116116            std::list<QuestEffect*> completeEffects_; //!< A list of effects to be invoked, when the quest has been completed.
  • code/trunk/src/orxonox/objects/quest/QuestDescription.cc

    r2091 r2092  
    3434
    3535    CreateFactory(QuestDescription);
    36    
    37     QuestDescription::QuestDescription() : BaseObject()
     36
     37    QuestDescription::QuestDescription(BaseObject* creator) : BaseObject(creator)
    3838    {
     39        RegisterObject(QuestDescription);
     40
    3941        this->initialize();
    4042    }
    41    
     43
    4244    QuestDescription::~QuestDescription()
    4345    {
    44        
     46
    4547    }
    46    
     48
    4749    void QuestDescription::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    4850    {
    4951        SUPER(QuestDescription, XMLPort, xmlelement, mode);
    50    
     52
    5153        XMLPortParam(QuestDescription, "title", setTitle, getTitle, xmlelement, mode);
    5254        XMLPortParam(QuestDescription, "description", setDescription, getDescription, xmlelement, mode);
    53        
     55
    5456        COUT(3) << "New QuestDescription with title '" << this->getTitle() << "' created." << std::endl;
    5557    }
    56    
     58
    5759    /**
    5860    @brief
  • code/trunk/src/orxonox/objects/quest/QuestDescription.h

    r2091 r2092  
    4545    */
    4646    class QuestDescription : public BaseObject {
    47    
     47
    4848        public:
    49             QuestDescription();
    50             ~QuestDescription();
    51            
     49            QuestDescription(BaseObject* creator);
     50            virtual ~QuestDescription();
     51
    5252            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    53            
     53
    5454            inline const std::string & getTitle(void) const //!< Returns the title.
    5555                { return this->title_; }
    5656            inline const std::string & getDescription(void) const //!< Returns the description text.
    5757                { return this->description_; }
    58            
     58
    5959        private:
    6060            void initialize(void);
    61            
     61
    6262            inline void setTitle(const std::string & title) //!< Sets the title.
    6363                { this->title_ = title; }
    6464            inline void setDescription(const std::string & description) //!< Sets the description text.
    6565                { this->description_ = description; }
    66                
     66
    6767            std::string title_; //!< The title.
    6868            std::string description_; //!< The description.
    69    
     69
    7070    };
    7171
  • code/trunk/src/orxonox/objects/quest/QuestEffect.cc

    r2091 r2092  
    3838        Is not meant to be invoked directly, since this is only an interface.
    3939    */
    40     QuestEffect::QuestEffect() : BaseObject()
     40    QuestEffect::QuestEffect(BaseObject* creator) : BaseObject(creator)
    4141    {
    4242        RegisterObject(QuestEffect);
    4343    }
    44    
     44
    4545    /**
    4646    @brief
     
    4949    QuestEffect::~QuestEffect()
    5050    {
    51        
     51
    5252    }
    53    
     53
    5454    /**
    5555    @brief
     
    6565    {
    6666        bool check = true;
    67        
     67
    6868        for (std::list<QuestEffect*>::iterator effect = effects.begin(); effect != effects.end(); effect++)
    6969        {
  • code/trunk/src/orxonox/objects/quest/QuestEffect.h

    r2091 r2092  
    4747    {
    4848        public:
    49             QuestEffect();
     49            QuestEffect(BaseObject* creator);
    5050            virtual ~QuestEffect();
    51            
     51
    5252            virtual bool invoke(Player* player) = 0; //!< Invokes the effect.
    5353            static bool invokeEffects(Player* player, std::list<QuestEffect*> & effects); //!< Invokes all effects in the list.
    54            
    55        
     54
     55
    5656    };
    5757
  • code/trunk/src/orxonox/objects/quest/QuestHint.cc

    r2091 r2092  
    4141        Constructor.
    4242    */
    43     QuestHint::QuestHint() : QuestItem()
     43    QuestHint::QuestHint(BaseObject* creator) : QuestItem(creator)
    4444    {
     45        RegisterObject(QuestHint);
     46
    4547        this->initialize();
    4648    }
    47    
     49
    4850    /**
    4951    @brief
     
    5254    QuestHint::~QuestHint()
    5355    {
    54        
     56
    5557    }
    56    
     58
    5759    void QuestHint::initialize(void)
    5860    {
    5961        RegisterObject(QuestHint);
    6062    }
    61    
     63
    6264    void QuestHint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    6365    {
    6466        SUPER(QuestHint, XMLPort, xmlelement, mode);
    65        
     67
    6668        COUT(3) << "New QuestHint {" << this->getId() << "} created." << std::endl;
    6769    }
    6870
    69    
     71
    7072    /**
    7173    @brief
     
    8587            return false;
    8688        }
    87        
     89
    8890        std::map<Player*, questHintStatus::Enum>::iterator it = this->playerStatus_.find(player);
    8991        if (it != this->playerStatus_.end())
     
    9395        return questStatus::inactive;
    9496    }
    95    
     97
    9698    /**
    9799    @brief
     
    134136            return false;
    135137        }
    136        
     138
    137139        this->quest_ = quest;
    138140        return true;
  • code/trunk/src/orxonox/objects/quest/QuestHint.h

    r2091 r2092  
    2626 *
    2727 */
    28  
     28
    2929#ifndef _QuestHint_H__
    3030#define _QuestHint_H__
     
    6464    class QuestHint : public QuestItem
    6565    {
    66    
     66
    6767        public:
    68             QuestHint();
    69             ~QuestHint();
    70            
     68            QuestHint(BaseObject* creator);
     69            virtual ~QuestHint();
     70
    7171            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    72            
     72
    7373            bool isActive(Player* player); //!< Returns true if the hint is active for the input player.
    74            
     74
    7575            bool activate(Player* player); //!< Activates the hint for the input player.
    76            
     76
    7777            bool setQuest(Quest* quest); //!< Sets the quest the hint belongs to.
    78            
     78
    7979            inline Quest* getQuest(void)
    8080               { return this->quest_; }
    81            
     81
    8282        private:
    83            
     83
    8484            void initialize(void);
    85            
     85
    8686            Quest* quest_; //!< The quest the hint belongs to.
    8787            std::map<Player*, questHintStatus::Enum> playerStatus_; //!< List of the status for each player, with the Player-pointer as key.
    88    
     88
    8989    };
    9090
  • code/trunk/src/orxonox/objects/quest/QuestItem.cc

    r2091 r2092  
    3232
    3333namespace orxonox {
    34    
    35     QuestItem::QuestItem() : BaseObject()
     34
     35    QuestItem::QuestItem(BaseObject* creator) : BaseObject(creator)
    3636    {
     37        RegisterObject(QuestItem);
     38
    3739        this->initialize();
    3840    }
    39    
     41
    4042    /**
    4143    @brief
     
    4446    QuestItem::~QuestItem()
    4547    {
    46        
     48
    4749    }
    48    
     50
    4951    void QuestItem::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    5052    {
    5153        SUPER(QuestItem, XMLPort, xmlelement, mode);
    52        
     54
    5355        XMLPortParam(QuestItem, "id", setId, getId, xmlelement, mode);
    5456        //Doesn't getDescription have to be of type getDescription(unsigned int) ?
     
    5860    }
    5961
    60    
     62
    6163    /**
    6264    @brief
     
    6769    {
    6870        RegisterObject(QuestItem);
    69        
     71
    7072        this->id_ = "";
    7173    }
    72    
     74
    7375    void QuestItem::setId(const std::string & id)
    7476    {
     
    8082        this->id_ = id;
    8183    }
    82    
     84
    8385    //const QuestDescription* QuestItem::getDescription(unsigned int index) const //!< Returns the description of the QuestItem.
    8486    //{
     
    8789    //    return this->description_;
    8890    //}
    89    
     91
    9092    /**
    9193    @brief
  • code/trunk/src/orxonox/objects/quest/QuestItem.h

    r2091 r2092  
    2626 *
    2727 */
    28  
     28
    2929#ifndef _QuestItem_H__
    3030#define _QuestItem_H__
     
    3838namespace orxonox {
    3939
    40    
     40
    4141    /**
    4242    @brief
     
    4848    class QuestItem : public BaseObject
    4949    {
    50    
     50
    5151        public:
    52             QuestItem();
     52            QuestItem(BaseObject* creator);
    5353            virtual ~QuestItem();
    54            
     54
    5555            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    56            
     56
    5757            inline const std::string & getId(void) const //!< Returns the id of this quest.
    5858                { return this->id_; }
     
    6060                { return this->description_; }
    6161            //const QuestDescription* getDescription(unsigned int index) const; //!< Returns the description of the QuestItem.
    62                
     62
    6363            static bool isId(const std::string & id); //!< Checks whether a given id is valid.
    64            
     64
    6565        protected:
    6666            void setId(const std::string & id);
    6767            inline void setDescription(QuestDescription* description)
    6868                { this->description_ = description; }
    69            
     69
    7070        private:
    7171            std::string id_; //!< Identifier. Should be of GUID form: http://en.wikipedia.org/wiki/Globally_Unique_Identifier#Basic_structure
    7272            QuestDescription* description_; //!< The description of the QuestItem.
    73            
     73
    7474            void initialize(void); //!< Initializes the object.
    75    
     75
    7676    };
    7777
  • code/trunk/src/orxonox/objects/quest/QuestManager.cc

    r2091 r2092  
    3737    std::map<std::string, QuestHint*> QuestManager::hintMap_;
    3838
    39     QuestManager::QuestManager() : BaseObject()
     39    QuestManager::QuestManager(BaseObject* creator) : BaseObject(creator)
    4040    {
    4141        RegisterObject(QuestManager);
    4242    }
    43    
    44    
     43
     44
    4545    QuestManager::~QuestManager()
    4646    {
    47        
     47
    4848    }
    4949
     
    6363            return false;
    6464        }
    65        
     65
    6666        std::pair<std::map<std::string, Quest*>::iterator,bool> ret;
    6767        ret = questMap_.insert( std::pair<std::string,Quest*>(quest->getId(),quest) );
    68        
     68
    6969        if(ret.second)
    7070        {
     
    7878        }
    7979    }
    80    
     80
    8181    /**
    8282    @brief
     
    9494            return false;
    9595        }
    96        
     96
    9797        std::pair<std::map<std::string, QuestHint*>::iterator,bool> ret;
    9898        ret = hintMap_.insert ( std::pair<std::string,QuestHint*>(hint->getId(),hint) );
    99        
     99
    100100        if(ret.second)
    101101        {
     
    109109        }
    110110    }
    111    
     111
    112112    /**
    113113    @brief
     
    127127            ThrowException(Argument, "Invalid questId.");
    128128        }
    129        
     129
    130130        Quest* quest;
    131131        std::map<std::string, Quest*>::iterator it = questMap_.find(questId);
     
    139139           COUT(2) << "The quest with id {" << questId << "} is nowhere to be found." << std::endl;
    140140        }
    141        
     141
    142142        return quest;
    143143
    144144    }
    145    
     145
    146146    /**
    147147    @brief
     
    161161            ThrowException(Argument, "Invalid hintId.");
    162162        }
    163        
     163
    164164        QuestHint* hint;
    165165        std::map<std::string, QuestHint*>::iterator it = hintMap_.find(hintId);
     
    173173           COUT(2) << "The hint with id {" << hintId << "} is nowhere to be found." << std::endl;
    174174        }
    175        
     175
    176176        return hint;
    177177
    178178    }
    179    
     179
    180180
    181181}
  • code/trunk/src/orxonox/objects/quest/QuestManager.h

    r2091 r2092  
    4848    class QuestManager : public BaseObject
    4949    {
    50    
     50
    5151        public:
    52             QuestManager();
    53             ~QuestManager();
    54            
     52            QuestManager(BaseObject* creator);
     53            virtual ~QuestManager();
     54
    5555            static bool registerQuest(Quest* quest); //!< Registers a quest in the QuestManager.
    5656            static bool registerHint(QuestHint* quest); //!< Registers a QuestHint in the QuestManager.
    57            
     57
    5858            static Quest* findQuest(const std::string & questId); //!< Returns the quest with the input id.
    5959            static QuestHint* findHint(const std::string & hintId); //!< Returns the QuestHint with the input id.
    60                    
     60
    6161        private:
    6262            static std::map<std::string, Quest*> questMap_; //!< All quests registered by their id's.
    6363            static std::map<std::string, QuestHint*> hintMap_; //!< All hints registered by their id's.
    64    
     64
    6565    };
    6666
  • code/trunk/src/orxonox/objects/quest/Rewardable.cc

    r2091 r2092  
    3333namespace orxonox {
    3434
    35    
    36     Rewardable::Rewardable() : BaseObject()
     35
     36    Rewardable::Rewardable(BaseObject* creator) : BaseObject(creator)
    3737    {
    3838        RegisterObject(Rewardable);
    3939    }
    40    
    41    
     40
     41
    4242    Rewardable::~Rewardable()
    4343    {
  • code/trunk/src/orxonox/objects/quest/Rewardable.h

    r2091 r2092  
    4444    class Rewardable : public BaseObject
    4545    {
    46    
     46
    4747        public:
    48             Rewardable();
     48            Rewardable(BaseObject* creator);
    4949            virtual ~Rewardable();
    50            
     50
    5151            virtual bool reward(Player* player) = 0; //!<Method to transcribe a rewardable object to the player.
    52    
     52
    5353    };
    5454
Note: See TracChangeset for help on using the changeset viewer.