Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2016, 10:29:21 PM (8 years ago)
Author:
landauf
Message:

merged branch cpp11_v3 back to trunk

Location:
code/trunk
Files:
29 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/modules/questsystem/GlobalQuest.cc

    r9667 r11071  
    9494
    9595        // Iterate through all players possessing this Quest.
    96         for(std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++)
    97             QuestEffect::invokeEffects(*it, this->getFailEffectList());
     96        for(PlayerInfo* questPlayer : players_)
     97            QuestEffect::invokeEffects(questPlayer, this->getFailEffectList());
    9898
    9999        return true;
     
    119119
    120120        // Iterate through all players possessing the Quest.
    121         for(std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++)
    122             QuestEffect::invokeEffects(*it, this->getCompleteEffectList());
     121        for(PlayerInfo* questPlayer : players_)
     122            QuestEffect::invokeEffects(questPlayer, this->getCompleteEffectList());
    123123
    124124        Quest::complete(player);
     
    138138    bool GlobalQuest::isStartable(const PlayerInfo* player) const
    139139    {
    140         if(!(this->getParentQuest() == NULL || this->getParentQuest()->isActive(player)))
     140        if(!(this->getParentQuest() == nullptr || this->getParentQuest()->isActive(player)))
    141141            return false;
    142142
     
    177177        The player.
    178178    */
    179     QuestStatus::Value GlobalQuest::getStatus(const PlayerInfo* player) const
     179    QuestStatus GlobalQuest::getStatus(const PlayerInfo* player) const
    180180    {
    181181        assert(player);
     
    198198        The status to be set.
    199199    @return
    200         Returns false if player is NULL.
    201     */
    202     bool GlobalQuest::setStatus(PlayerInfo* player, const QuestStatus::Value & status)
     200        Returns false if player is nullptr.
     201    */
     202    bool GlobalQuest::setStatus(PlayerInfo* player, const QuestStatus & status)
    203203    {
    204204        assert(player);
     
    242242    {
    243243        int i = index;
    244         for (std::list<QuestEffect*>::const_iterator effect = this->rewards_.begin(); effect != this->rewards_.end(); ++effect)
     244        for (QuestEffect* reward : this->rewards_)
    245245        {
    246246            if(i == 0)
    247                return *effect;
     247               return reward;
    248248
    249249            i--;
    250250        }
    251         return NULL;
     251        return nullptr;
    252252    }
    253253
  • code/trunk/src/modules/questsystem/GlobalQuest.h

    r9667 r11071  
    9393            virtual ~GlobalQuest();
    9494
    95             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a GlobalQuest object through XML.
     95            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a GlobalQuest object through XML.
    9696
    97             virtual bool fail(PlayerInfo* player); //!< Fails the Quest.
    98             virtual bool complete(PlayerInfo* player); //!< Completes the Quest.
     97            virtual bool fail(PlayerInfo* player) override; //!< Fails the Quest.
     98            virtual bool complete(PlayerInfo* player) override; //!< Completes the Quest.
    9999
    100100        protected:
    101             virtual bool isStartable(const PlayerInfo* player) const; //!< Checks whether the Quest can be started.
    102             virtual bool isFailable(const PlayerInfo* player) const; //!< Checks whether the Quest can be failed.
    103             virtual bool isCompletable(const PlayerInfo* player) const; //!< Checks whether the Quest can be completed.
     101            virtual bool isStartable(const PlayerInfo* player) const override; //!< Checks whether the Quest can be started.
     102            virtual bool isFailable(const PlayerInfo* player) const override; //!< Checks whether the Quest can be failed.
     103            virtual bool isCompletable(const PlayerInfo* player) const override; //!< Checks whether the Quest can be completed.
    104104
    105             virtual QuestStatus::Value getStatus(const PlayerInfo* player) const; //!< Returns the status of the Quest for a specific player.
     105            virtual QuestStatus getStatus(const PlayerInfo* player) const override; //!< Returns the status of the Quest for a specific player.
    106106
    107             virtual bool setStatus(PlayerInfo* player, const QuestStatus::Value & status); //!< Sets the status for a specific player.
     107            virtual bool setStatus(PlayerInfo* player, const QuestStatus & status) override; //!< Sets the status for a specific player.
    108108
    109109        private:
    110110            std::set<PlayerInfo*> players_; //!< The set of players which possess this Quest.
    111             QuestStatus::Value status_; //!< The status of this Quest.
     111            QuestStatus status_; //!< The status of this Quest.
    112112            std::list<QuestEffect*> rewards_; //!< Reward QuestEffects only invoked on the player completing the Quest.
    113113
  • code/trunk/src/modules/questsystem/LocalQuest.cc

    r9667 r11071  
    128128    bool LocalQuest::isStartable(const PlayerInfo* player) const
    129129    {
    130         if(!(this->getParentQuest() == NULL || this->getParentQuest()->isActive(player)))
     130        if(!(this->getParentQuest() == nullptr || this->getParentQuest()->isActive(player)))
    131131            return false;
    132132
     
    168168        Returns the status of the Quest for the input player.
    169169    */
    170     QuestStatus::Value LocalQuest::getStatus(const PlayerInfo* player) const
     170    QuestStatus LocalQuest::getStatus(const PlayerInfo* player) const
    171171    {
    172172        assert(player);
    173173
    174         std::map<const PlayerInfo*, QuestStatus::Value>::const_iterator it = this->playerStatus_.find(player);
     174        std::map<const PlayerInfo*, QuestStatus>::const_iterator it = this->playerStatus_.find(player);
    175175        if (it != this->playerStatus_.end()) // If there is a player in the map.
    176176            return it->second;
     
    188188        The status to be set.
    189189    @return
    190         Returns false if player is NULL.
    191     */
    192     bool LocalQuest::setStatus(PlayerInfo* player, const QuestStatus::Value & status)
     190        Returns false if player is nullptr.
     191    */
     192    bool LocalQuest::setStatus(PlayerInfo* player, const QuestStatus & status)
    193193    {
    194194        assert(player);
  • code/trunk/src/modules/questsystem/LocalQuest.h

    r9667 r11071  
    8787            virtual ~LocalQuest();
    8888
    89             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a LocalQuest object through XML.
     89            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a LocalQuest object through XML.
    9090
    91             virtual bool fail(PlayerInfo* player); //!< Fails the Quest.
    92             virtual bool complete(PlayerInfo* player); //!< Completes the Quest.
     91            virtual bool fail(PlayerInfo* player) override; //!< Fails the Quest.
     92            virtual bool complete(PlayerInfo* player) override; //!< Completes the Quest.
    9393
    9494        protected:
    95             virtual bool isStartable(const PlayerInfo* player) const; //!< Checks whether the Quest can be started.
    96             virtual bool isFailable(const PlayerInfo* player) const; //!< Checks whether the Quest can be failed.
    97             virtual bool isCompletable(const PlayerInfo* player) const; //!< Checks whether the Quest can be completed.
     95            virtual bool isStartable(const PlayerInfo* player) const override; //!< Checks whether the Quest can be started.
     96            virtual bool isFailable(const PlayerInfo* player) const override; //!< Checks whether the Quest can be failed.
     97            virtual bool isCompletable(const PlayerInfo* player) const override; //!< Checks whether the Quest can be completed.
    9898
    99             virtual QuestStatus::Value getStatus(const PlayerInfo* player) const; //!< Returns the status of the Quest for a specific player.
    100             virtual bool setStatus(PlayerInfo* player, const QuestStatus::Value & status); //!< Sets the status for a specific player.
     99            virtual QuestStatus getStatus(const PlayerInfo* player) const override; //!< Returns the status of the Quest for a specific player.
     100            virtual bool setStatus(PlayerInfo* player, const QuestStatus & status) override; //!< Sets the status for a specific player.
    101101
    102102        private:
    103             std::map<const PlayerInfo*, QuestStatus::Value> playerStatus_; //!< List of the status for each player, with the Player-pointer as key.
     103            std::map<const PlayerInfo*, QuestStatus> playerStatus_; //!< List of the status for each player, with the Player-pointer as key.
    104104
    105105    };
  • code/trunk/src/modules/questsystem/Quest.cc

    r10624 r11071  
    5555        RegisterObject(Quest);
    5656
    57         this->parentQuest_ = NULL;
     57        this->parentQuest_ = nullptr;
    5858    }
    5959
     
    183183        The index.
    184184    @return
    185         Returns a pointer to the sub-quest at the given index. NULL if there is no element at the given index.
     185        Returns a pointer to the sub-quest at the given index. nullptr if there is no element at the given index.
    186186    */
    187187    const Quest* Quest::getSubQuest(unsigned int index) const
     
    190190
    191191        // Iterate through all subquests.
    192         for (std::list<Quest*>::const_iterator subQuest = this->subQuests_.begin(); subQuest != this->subQuests_.end(); ++subQuest)
     192        for (Quest* quest : this->subQuests_)
    193193        {
    194194            if(i == 0) // We're counting down...
    195                return *subQuest;
     195               return quest;
    196196
    197197            i--;
    198198        }
    199199
    200         return NULL; // If the index is greater than the number of elements in the list.
     200        return nullptr; // If the index is greater than the number of elements in the list.
    201201    }
    202202
     
    207207        The index.
    208208    @return
    209         Returns a pointer to the QuestHint at the given index. NULL if there is no element at the given index.
     209        Returns a pointer to the QuestHint at the given index. nullptr if there is no element at the given index.
    210210    */
    211211    const QuestHint* Quest::getHint(unsigned int index) const
     
    214214
    215215        // Iterate through all QuestHints.
    216         for (std::list<QuestHint*>::const_iterator hint = this->hints_.begin(); hint != this->hints_.end(); ++hint)
     216        for (QuestHint* hint : this->hints_)
    217217        {
    218218            if(i == 0) // We're counting down...
    219                return *hint;
     219               return hint;
    220220
    221221            i--;
    222222        }
    223         return NULL; // If the index is greater than the number of elements in the list.
     223        return nullptr; // If the index is greater than the number of elements in the list.
    224224    }
    225225
     
    230230        The index.
    231231    @return
    232         Returns a pointer to the fail QuestEffect at the given index. NULL if there is no element at the given index.
     232        Returns a pointer to the fail QuestEffect at the given index. nullptr if there is no element at the given index.
    233233    */
    234234    const QuestEffect* Quest::getFailEffect(unsigned int index) const
     
    237237
    238238        // Iterate through all fail QuestEffects.
    239         for (std::list<QuestEffect*>::const_iterator effect = this->failEffects_.begin(); effect != this->failEffects_.end(); ++effect)
     239        for (QuestEffect* effect : this->failEffects_)
    240240        {
    241241            if(i == 0) // We're counting down...
    242                return *effect;
     242               return effect;
    243243
    244244            i--;
    245245        }
    246         return NULL; // If the index is greater than the number of elements in the list.
     246        return nullptr; // If the index is greater than the number of elements in the list.
    247247    }
    248248
     
    253253        The index.
    254254    @return
    255         Returns a pointer to the complete QuestEffect at the given index. NULL if there is no element at the given index.
     255        Returns a pointer to the complete QuestEffect at the given index. nullptr if there is no element at the given index.
    256256    */
    257257    const QuestEffect* Quest::getCompleteEffect(unsigned int index) const
     
    260260
    261261        // Iterate through all complete QuestEffects.
    262         for (std::list<QuestEffect*>::const_iterator effect = this->completeEffects_.begin(); effect != this->completeEffects_.end(); ++effect)
     262        for (QuestEffect* effect : this->completeEffects_)
    263263        {
    264264            if(i == 0) // We're counting down...
    265                return *effect;
     265               return effect;
    266266
    267267            i--;
    268268        }
    269         return NULL; // If the index is greater than the number of elements in the list.
     269        return nullptr; // If the index is greater than the number of elements in the list.
    270270    }
    271271
     
    280280    bool Quest::isInactive(const PlayerInfo* player) const
    281281    {
    282         if(player == NULL)
     282        if(player == nullptr)
    283283            return true;
    284284        return this->getStatus(player) == QuestStatus::Inactive;
     
    295295    bool Quest::isActive(const PlayerInfo* player) const
    296296    {
    297         if(player == NULL)
     297        if(player == nullptr)
    298298            return false;
    299299        return this->getStatus(player) == QuestStatus::Active;
     
    310310    bool Quest::isFailed(const PlayerInfo* player) const
    311311    {
    312         if(player == NULL)
     312        if(player == nullptr)
    313313            return false;
    314314        return this->getStatus(player) == QuestStatus::Failed;
     
    325325    bool Quest::isCompleted(const PlayerInfo* player) const
    326326    {
    327         if(player == NULL)
     327        if(player == nullptr)
    328328            return false;
    329329        return this->getStatus(player) == QuestStatus::Completed;
  • code/trunk/src/modules/questsystem/Quest.h

    r9667 r11071  
    5151    @ingroup Questsystem
    5252    */
    53     namespace QuestStatus
     53    enum class QuestStatus
    5454    {
    55         enum Value
    56         {
    57             Inactive, //!< The @ref orxonox::Quest "Quest" is inactive.
    58             Active, //!< The @ref orxonox::Quest "Quest" is active.
    59             Failed, //!< The @ref orxonox::Quest "Quest" has been failed.
    60             Completed //!< The @ref orxonox::Quest "Quest" has been completed.
    61         };
    62     }
     55        Inactive, //!< The @ref orxonox::Quest "Quest" is inactive.
     56        Active, //!< The @ref orxonox::Quest "Quest" is active.
     57        Failed, //!< The @ref orxonox::Quest "Quest" has been failed.
     58        Completed //!< The @ref orxonox::Quest "Quest" has been completed.
     59    };
    6360
    6461    /**
     
    8582            virtual ~Quest();
    8683
    87             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a Quest object through XML.
     84            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a Quest object through XML.
    8885
    8986            /**
     
    143140                { return this->completeEffects_; }
    144141
    145             virtual QuestStatus::Value getStatus(const PlayerInfo* player) const = 0; //!< Returns the status of the Quest for a specific player.
    146             virtual bool setStatus(PlayerInfo* player, const QuestStatus::Value & status) = 0; //!< Changes the status for a specific player.
     142            virtual QuestStatus getStatus(const PlayerInfo* player) const = 0; //!< Returns the status of the Quest for a specific player.
     143            virtual bool setStatus(PlayerInfo* player, const QuestStatus & status) = 0; //!< Changes the status for a specific player.
    147144
    148145        private:
  • code/trunk/src/modules/questsystem/QuestDescription.cc

    r9667 r11071  
    119119        }
    120120
    121         NotificationListener::sendNotification(message, QuestDescription::SENDER, notificationMessageType::info, notificationSendMode::network, player->getClientID());
     121        NotificationListener::sendNotification(message, QuestDescription::SENDER, NotificationMessageType::info, NotificationSendMode::network, player->getClientID());
    122122        return true;
    123123    }
  • code/trunk/src/modules/questsystem/QuestDescription.h

    r9667 r11071  
    6767            virtual ~QuestDescription();
    6868
    69             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestDescription object through XML.
     69            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a QuestDescription object through XML.
    7070
    7171// tolua_begin
  • code/trunk/src/modules/questsystem/QuestEffect.cc

    r10624 r11071  
    7474        orxout(verbose, context::quests) << "Invoking QuestEffects on player: " << player << " ."  << endl;
    7575
    76         for (std::list<QuestEffect*>::iterator effect = effects.begin(); effect != effects.end(); effect++)
    77             temp = temp && (*effect)->invoke(player);
     76        for (QuestEffect* effect : effects)
     77            temp = temp && effect->invoke(player);
    7878
    7979        return temp;
  • code/trunk/src/modules/questsystem/QuestEffectBeacon.cc

    r9667 r11071  
    113113
    114114        PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger);
    115         PlayerInfo* player = NULL;
     115        PlayerInfo* player = nullptr;
    116116
    117117        // If the trigger is a PlayerTrigger.
    118         if(pTrigger != NULL)
     118        if(pTrigger != nullptr)
    119119        {
    120120            if(!pTrigger->isForPlayer())  // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one.
     
    126126            return false;
    127127
    128         if(player == NULL)
     128        if(player == nullptr)
    129129        {
    130130            orxout(verbose, context::quests) << "The QuestEffectBeacon was triggered by an entity other than a Pawn. (" << trigger->getIdentifier()->getName() << ")" << endl;
     
    236236    {
    237237        int i = index;
    238         for (std::list<QuestEffect*>::const_iterator effect = this->effects_.begin(); effect != this->effects_.end(); ++effect)
     238        for (QuestEffect* effect : this->effects_)
    239239        {
    240240            if(i == 0)
    241                return *effect;
     241               return effect;
    242242
    243243            i--;
    244244        }
    245         return NULL;
     245        return nullptr;
    246246    }
    247247
  • code/trunk/src/modules/questsystem/QuestEffectBeacon.h

    r9667 r11071  
    5050    @ingroup Questsystem
    5151    */
    52     namespace QuestEffectBeaconStatus
     52    enum class QuestEffectBeaconStatus
    5353    {
    54         enum Value
    55         {
    56             Inactive, //!< The @ref orxonox::QuestEffectBeacon "QuestEffectBeacon" is inactive.
    57             Active //!< The @ref orxonox::QuestEffectBeacon "QuestEffectBeacon" is active.
    58         };
    59     }
     54        Inactive, //!< The @ref orxonox::QuestEffectBeacon "QuestEffectBeacon" is inactive.
     55        Active //!< The @ref orxonox::QuestEffectBeacon "QuestEffectBeacon" is active.
     56    };
    6057
    6158    /**
     
    9693            virtual ~QuestEffectBeacon();
    9794
    98             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestEffectBeacon object through XML.
    99             virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
     95            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a QuestEffectBeacon object through XML.
     96            virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override;
    10097
    10198            bool execute(bool bTriggered, BaseObject* trigger); //!< Executes the QuestEffects of the QuestEffectBeacon.
     
    125122            std::list<QuestEffect*> effects_; //!< The list of QuestEffects to be invoked on the executing player.
    126123            int times_; //!< Number of times the beacon can be exectued.
    127             QuestEffectBeaconStatus::Value status_; //!< The status of the QuestEffectBeacon, Can be eighter active or inactive.
     124            QuestEffectBeaconStatus status_; //!< The status of the QuestEffectBeacon, Can be eighter active or inactive.
    128125
    129126            bool setTimes(const int & n); //!< Set the number of times the QuestEffectBeacon can be executed.
  • code/trunk/src/modules/questsystem/QuestHint.cc

    r9667 r11071  
    8888    bool QuestHint::isActive(const PlayerInfo* player) const
    8989    {
    90         if(player == NULL) // If the player is NULL, the Quest obviously can't be active.
     90        if(player == nullptr) // If the player is nullptr, the Quest obviously can't be active.
    9191            return false;
    9292
    9393        // Find the player.
    94         std::map<const PlayerInfo*, QuestHintStatus::Value>::const_iterator it = this->playerStatus_.find(player);
     94        std::map<const PlayerInfo*, QuestHintStatus>::const_iterator it = this->playerStatus_.find(player);
    9595        if (it != this->playerStatus_.end()) // If the player is in the map.
    96             return it->second;
     96            return (it->second == QuestHintStatus::Active);
    9797
    98         return QuestStatus::Inactive;
     98        return false;
    9999    }
    100100
  • code/trunk/src/modules/questsystem/QuestHint.h

    r9667 r11071  
    5050    @ingroup Questsystem
    5151    */
    52     namespace QuestHintStatus
     52    enum class QuestHintStatus
    5353    {
    54         enum Value
    55         {
    56             Inactive, //!< The @ref orxonox::QuestHint "QuestHint" is inactive.
    57             Active //!< The @ref orxonox::QuestHint "QuestHint" is active.
    58         };
    59     }
     54        Inactive, //!< The @ref orxonox::QuestHint "QuestHint" is inactive.
     55        Active //!< The @ref orxonox::QuestHint "QuestHint" is active.
     56    };
    6057
    6158    /**
     
    8582            virtual ~QuestHint();
    8683
    87             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestHint object through XML.
     84            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a QuestHint object through XML.
    8885
    8986            bool isActive(const PlayerInfo* player) const; //!< Returns true if the QuestHint is active for the input player.
     
    10198        private:
    10299            Quest* quest_; //!< The Quest the QuestHint belongs to.
    103             std::map<const PlayerInfo*, QuestHintStatus::Value> playerStatus_; //!< List of the states for each player, with the Player-pointer as key.
     100            std::map<const PlayerInfo*, QuestHintStatus> playerStatus_; //!< List of the states for each player, with the Player-pointer as key.
    104101
    105102    }; // tolua_export
  • code/trunk/src/modules/questsystem/QuestItem.h

    r9667 r11071  
    6363            virtual ~QuestItem();
    6464
    65             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestItem object through XML.
     65            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a QuestItem object through XML.
    6666
    6767            /**
  • code/trunk/src/modules/questsystem/QuestListener.cc

    r9667 r11071  
    5959
    6060        this->mode_ = QuestListenerMode::All;
    61         this->quest_ = NULL;
     61        this->quest_ = nullptr;
    6262    }
    6363
     
    8181        XMLPortParam(QuestListener, "mode", setMode, getMode, xmlelement, mode);
    8282
    83         if(this->quest_ != NULL)
     83        if(this->quest_ != nullptr)
    8484            this->quest_->addListener(this); // Adds the QuestListener to the Quests list of listeners.
    8585
     
    9797    /* static */ void QuestListener::advertiseStatusChange(std::list<QuestListener*> & listeners, const std::string & status)
    9898    {
    99         for (std::list<QuestListener*>::iterator it = listeners.begin(); it != listeners.end(); ++it) // Iterate through all QuestListeners
    100         {
    101             QuestListener* listener = *it;
     99        for (QuestListener* listener : listeners) // Iterate through all QuestListeners
     100        {
    102101            if(listener->getMode() == status || listener->getMode() == QuestListener::ALL) // Check whether the status change affects the give QuestListener.
    103102                listener->execute();
     
    117116        this->quest_ = QuestManager::getInstance().findQuest(id); // Find the Quest corresponding to the given questId.
    118117
    119         if(this->quest_ == NULL) // If there is no such Quest.
     118        if(this->quest_ == nullptr) // If there is no such Quest.
    120119        {
    121120            ThrowException(Argument, "This is bad! The QuestListener has not found a Quest with a corresponding id..");
  • code/trunk/src/modules/questsystem/QuestListener.h

    r9667 r11071  
    5050    @ingroup Questsystem
    5151    */
    52     namespace QuestListenerMode
     52    enum class QuestListenerMode
    5353    {
    54         enum Value
    55         {
    56             All, //!< Listens to all events.
    57             Start, //!< Only listens to events pertaining the starting of @ref orxonox::Quest "Quests".
    58             Fail, //!< Only listens to events pertaining the failing of @ref orxonox::Quest "Quests".
    59             Complete //!< Only listens to events pertaining the completing of @ref orxonox::Quest "Quests".
    60         };
    61     }
     54        All, //!< Listens to all events.
     55        Start, //!< Only listens to events pertaining the starting of @ref orxonox::Quest "Quests".
     56        Fail, //!< Only listens to events pertaining the failing of @ref orxonox::Quest "Quests".
     57        Complete //!< Only listens to events pertaining the completing of @ref orxonox::Quest "Quests".
     58    };
    6259
    6360    /**
     
    9087            virtual ~QuestListener();
    9188
    92             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestListener object through XML.
     89            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a QuestListener object through XML.
    9390
    9491            static void advertiseStatusChange(std::list<QuestListener*> & listeners, const std::string & status); //!< Makes all QuestListener in the list aware that a certain status change has occured.
     
    103100
    104101        private:
    105             QuestListenerMode::Value mode_; //!< The mode of the QuestListener.
     102            QuestListenerMode mode_; //!< The mode of the QuestListener.
    106103            Quest* quest_; //!< A pointer to the Quest the QuestListener is reacting to.
    107104
  • code/trunk/src/modules/questsystem/QuestManager.cc

    r10624 r11071  
    9393    bool QuestManager::registerQuest(Quest* quest)
    9494    {
    95         if(quest == NULL)
    96         {
    97             orxout(internal_error, context::quests) << "Quest pointer is NULL." << endl;
     95        if(quest == nullptr)
     96        {
     97            orxout(internal_error, context::quests) << "Quest pointer is nullptr." << endl;
    9898            return false;
    9999        }
     
    135135    bool QuestManager::registerHint(QuestHint* hint)
    136136    {
    137         if(hint == NULL)
    138         {
    139             orxout(internal_error, context::quests) << "Quest pointer is NULL." << endl;
     137        if(hint == nullptr)
     138        {
     139            orxout(internal_error, context::quests) << "Quest pointer is nullptr." << endl;
    140140            return false;
    141141        }
     
    173173    @return
    174174        Returns a pointer to the Quest with the input id.
    175         Returns NULL if there is no Quest with the given questId.
     175        Returns nullptr if there is no Quest with the given questId.
    176176    @throws
    177177        Throws an exception if the given questId is invalid.
     
    188188        else
    189189        {
    190            quest = NULL;
     190           quest = nullptr;
    191191           orxout(internal_warning, context::quests) << "The quest with id {" << questId << "} is nowhere to be found." << endl;
    192192        }
     
    202202    @return
    203203        Returns a pointer to the QuestHint with the input id.
    204         Returns NULL if there is no QuestHint with the given hintId.
     204        Returns nullptr if there is no QuestHint with the given hintId.
    205205    @throws
    206206        Throws an exception if the given hintId is invalid.
     
    217217        else
    218218        {
    219            hint = NULL;
     219           hint = nullptr;
    220220           orxout(internal_warning, context::quests) << "The hint with id {" << hintId << "} is nowhere to be found." << endl;
    221221        }
     
    235235    {
    236236        int numQuests = 0;
    237         for(std::map<std::string, Quest*>::iterator it = this->questMap_.begin(); it != this->questMap_.end(); it++)
    238         {
    239             if(it->second->getParentQuest() == NULL && !it->second->isInactive(player))
     237        for(const auto& mapEntry : this->questMap_)
     238        {
     239            if(mapEntry.second->getParentQuest() == nullptr && !mapEntry.second->isInactive(player))
    240240                numQuests++;
    241241        }
     
    255255    Quest* QuestManager::getRootQuest(PlayerInfo* player, int index)
    256256    {
    257         for(std::map<std::string, Quest*>::iterator it = this->questMap_.begin(); it != this->questMap_.end(); it++)
    258         {
    259             if(it->second->getParentQuest() == NULL && !it->second->isInactive(player) && index-- == 0)
    260                 return it->second;
    261         }
    262         return NULL;
     257        for(const auto& mapEntry : this->questMap_)
     258        {
     259            if(mapEntry.second->getParentQuest() == nullptr && !mapEntry.second->isInactive(player) && index-- == 0)
     260                return mapEntry.second;
     261        }
     262        return nullptr;
    263263    }
    264264
     
    275275    int QuestManager::getNumSubQuests(Quest* quest, PlayerInfo* player)
    276276    {
    277         if(quest == NULL)
     277        if(quest == nullptr)
    278278            return this->getNumRootQuests(player);
    279279
    280280        std::list<Quest*> quests = quest->getSubQuestList();
    281281        int numQuests = 0;
    282         for(std::list<Quest*>::iterator it = quests.begin(); it != quests.end(); it++)
    283         {
    284             if(!(*it)->isInactive(player))
     282        for(Quest* subquest : quests)
     283        {
     284            if(!subquest->isInactive(player))
    285285                numQuests++;
    286286        }
     
    300300    Quest* QuestManager::getSubQuest(Quest* quest, PlayerInfo* player, int index)
    301301    {
    302         if(quest == NULL)
     302        if(quest == nullptr)
    303303            return this->getRootQuest(player, index);
    304304
    305305        std::list<Quest*> quests = quest->getSubQuestList();
    306         for(std::list<Quest*>::iterator it = quests.begin(); it != quests.end(); it++)
    307         {
    308             if(!(*it)->isInactive(player) && index-- == 0)
    309                 return *it;
    310         }
    311         return NULL;
     306        for(Quest* subquest : quests)
     307        {
     308            if(!subquest->isInactive(player) && index-- == 0)
     309                return quest;
     310        }
     311        return nullptr;
    312312    }
    313313
     
    326326        std::list<QuestHint*> hints = quest->getHintsList();
    327327        int numHints = 0;
    328         for(std::list<QuestHint*>::iterator it = hints.begin(); it != hints.end(); it++)
    329         {
    330             if((*it)->isActive(player))
     328        for(QuestHint* hint : hints)
     329        {
     330            if(hint->isActive(player))
    331331                numHints++;
    332332        }
     
    349349    {
    350350        std::list<QuestHint*> hints = quest->getHintsList();
    351         for(std::list<QuestHint*>::iterator it = hints.begin(); it != hints.end(); it++)
    352         {
    353             if((*it)->isActive(player) && index-- == 0)
    354                 return *it;
    355         }
    356         return NULL;
     351        for(QuestHint* hint : hints)
     352        {
     353            if(hint->isActive(player) && index-- == 0)
     354                return hint;
     355        }
     356        return nullptr;
    357357    }
    358358
     
    367367    Quest* QuestManager::getParentQuest(Quest* quest)
    368368    {
    369         OrxAssert(quest, "The input Quest is NULL.");
     369        OrxAssert(quest, "The input Quest is nullptr.");
    370370        return quest->getParentQuest();
    371371    }
     
    381381    QuestDescription* QuestManager::getDescription(Quest* item)
    382382    {
    383         OrxAssert(item, "The input Quest is NULL.");
     383        OrxAssert(item, "The input Quest is nullptr.");
    384384        return item->getDescription();
    385385    }
     
    395395    QuestDescription* QuestManager::getDescription(QuestHint* item)
    396396    {
    397         OrxAssert(item, "The input QuestHint is NULL.");
     397        OrxAssert(item, "The input QuestHint is nullptr.");
    398398        return item->getDescription();
    399399    }
     
    409409    const std::string QuestManager::getId(Quest* item) const
    410410    {
    411         OrxAssert(item, "The input Quest is NULL.");
     411        OrxAssert(item, "The input Quest is nullptr.");
    412412        return item->getId();
    413413    }
     
    423423    const std::string QuestManager::getId(QuestHint* item) const
    424424    {
    425         OrxAssert(item, "The input QuestHint is NULL.");
     425        OrxAssert(item, "The input QuestHint is nullptr.");
    426426        return item->getId();
    427427    }
     
    440440    {
    441441        PlayerInfo* player = GUIManager::getInstance().getPlayer(guiName);
    442         if(player == NULL)
     442        if(player == nullptr)
    443443        {
    444444            orxout(internal_error, context::quests) << "GUIOverlay with name '" << guiName << "' has no player." << endl;
    445             return NULL;
     445            return nullptr;
    446446        }
    447447
  • code/trunk/src/modules/questsystem/effects/AddQuest.cc

    r9667 r11071  
    9090        {
    9191            Quest* quest = QuestManager::getInstance().findQuest(this->getQuestId());
    92             if(quest == NULL || !quest->start(player))
     92            if(quest == nullptr || !quest->start(player))
    9393               return false;
    9494        }
  • code/trunk/src/modules/questsystem/effects/AddQuest.h

    r9667 r11071  
    6262        virtual ~AddQuest();
    6363
    64         virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a AddQuest object through XML.
     64        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a AddQuest object through XML.
    6565
    66         virtual bool invoke(PlayerInfo* player); //!< Invokes the QuestEffect.
     66        virtual bool invoke(PlayerInfo* player) override; //!< Invokes the QuestEffect.
    6767
    6868    };
  • code/trunk/src/modules/questsystem/effects/AddQuestHint.cc

    r9667 r11071  
    113113        {
    114114            QuestHint* hint = QuestManager::getInstance().findHint(this->hintId_);
    115             if(hint == NULL || !hint->setActive(player))
     115            if(hint == nullptr || !hint->setActive(player))
    116116                return false;
    117117        }
  • code/trunk/src/modules/questsystem/effects/AddQuestHint.h

    r9667 r11071  
    6464            virtual ~AddQuestHint();
    6565
    66             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a AddQuestHint object through XML.
     66            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a AddQuestHint object through XML.
    6767
    68             virtual bool invoke(PlayerInfo* player); //!< Invokes the QuestEffect.
     68            virtual bool invoke(PlayerInfo* player) override; //!< Invokes the QuestEffect.
    6969
    7070        private:
  • code/trunk/src/modules/questsystem/effects/AddReward.cc

    r9667 r11071  
    8484    {
    8585        int i = index;
    86         for (std::list<Rewardable*>::const_iterator reward = this->rewards_.begin(); reward != this->rewards_.end(); ++reward)
     86        for (Rewardable* reward : this->rewards_)
    8787        {
    8888            if(i == 0)
    89                return *reward;
     89               return reward;
    9090            i--;
    9191        }
    92         return NULL;
     92        return nullptr;
    9393    }
    9494
     
    106106
    107107        bool temp = true;
    108         for ( std::list<Rewardable*>::iterator reward = this->rewards_.begin(); reward != this->rewards_.end(); ++reward )
    109             temp = temp && (*reward)->reward(player);
     108        for (Rewardable* reward : this->rewards_)
     109            temp = temp && reward->reward(player);
    110110
    111111        orxout(verbose, context::quests) << "Rewardable successfully added to player." << player << " ." << endl;
  • code/trunk/src/modules/questsystem/effects/AddReward.h

    r9667 r11071  
    6868            virtual ~AddReward();
    6969
    70             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a AddReward object through XML.
     70            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a AddReward object through XML.
    7171
    72             virtual bool invoke(PlayerInfo* player); //!< Invokes the QuestEffect.
     72            virtual bool invoke(PlayerInfo* player) override; //!< Invokes the QuestEffect.
    7373
    7474        private:
  • code/trunk/src/modules/questsystem/effects/ChangeQuestStatus.h

    r9667 r11071  
    5959            virtual ~ChangeQuestStatus();
    6060
    61             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a ChangeQuestStatus object through XML.
     61            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a ChangeQuestStatus object through XML.
    6262
    6363            virtual bool invoke(PlayerInfo* player) = 0; //!< Invokes the QuestEffect.
  • code/trunk/src/modules/questsystem/effects/CompleteQuest.cc

    r9667 r11071  
    9292        {
    9393            quest = QuestManager::getInstance().findQuest(this->getQuestId());
    94             if(quest == NULL || !quest->complete(player))
     94            if(quest == nullptr || !quest->complete(player))
    9595               return false;
    9696        }
  • code/trunk/src/modules/questsystem/effects/CompleteQuest.h

    r9667 r11071  
    6262            virtual ~CompleteQuest();
    6363
    64             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a CompleteQuest object through XML.
     64            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a CompleteQuest object through XML.
    6565
    66             virtual bool invoke(PlayerInfo* player); //!< Invokes the QuestEffect.
     66            virtual bool invoke(PlayerInfo* player) override; //!< Invokes the QuestEffect.
    6767
    6868    };
  • code/trunk/src/modules/questsystem/effects/FailQuest.cc

    r9667 r11071  
    9191        {
    9292            quest = QuestManager::getInstance().findQuest(this->getQuestId());
    93             if(quest == NULL || !quest->fail(player))
     93            if(quest == nullptr || !quest->fail(player))
    9494               return false;
    9595        }
  • code/trunk/src/modules/questsystem/effects/FailQuest.h

    r9667 r11071  
    6262            virtual ~FailQuest();
    6363
    64             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a FailQuest object through XML.
     64            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a FailQuest object through XML.
    6565
    66             virtual bool invoke(PlayerInfo* player); //!< Invokes the QuestEffect.
     66            virtual bool invoke(PlayerInfo* player) override; //!< Invokes the QuestEffect.
    6767
    6868    };
Note: See TracChangeset for help on using the changeset viewer.