Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 22, 2008, 4:03:10 PM (16 years ago)
Author:
dafrick
Message:

Some cleaning, reorganization and implementation of some small methods.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/questsystem/src/orxonox/objects/Quest.cc

    r1992 r1996  
    7171    /**
    7272    @brief
     73        Sets the parent quest of the quest.
     74    @param quest
     75        A pointer to the quest to be set as parent quest.
     76    */
     77    bool setParentQuest(Quest* quest)
     78    {
     79        this->parentQuest_ = quest;
     80        return true;
     81    }
     82   
     83    /**
     84    @brief
     85        Adds a sub quest to the quest.
     86    @param quest
     87        A pointer to the quest to be set as sub quest.
     88    */
     89    bool addSubQuest(Quest & quest)
     90    {
     91        this->subQuests_.push_back = quest;
     92        return true;
     93    }
     94
     95    /**
     96    @brief
    7397        Adds a Hint to the list of hints
    7498    @param hint
     
    93117    @param player
    94118        The player.
     119    @return
     120        Returns true if the quest could be started, false if not.
    95121    */
    96     void Quest::start(const Player & player)
     122    bool Quest::start(const Player & player)
    97123    {
    98         if(this->isInactive(player))
     124        if(this->isStartable(player))
    99125        {
    100126            this->setStatus(player, questStatus::active);
     127            return true;
    101128        }
    102         else
    103         {
    104             COUT(2) << "A non-inactive quest was trying to be started." << std::endl;
    105         }
     129        COUT(2) << "A non-startable quest was trying to be started." << std::endl;
     130        return false;
    106131    }
    107132   
     
    111136    @param player
    112137        The player.
     138    @return
     139        Returns true if the quest could be failed, false if not.
    113140    */
    114141    void Quest::fail(Player & player)
    115142    {
    116         if(this->isActive(player))
     143        if(this->isFailable(player))
    117144        {
    118145            this->setStatus(player, questStatus::failed);
    119146            QuestEffect::invokeEffects(player, this->failEffects_);
     147            return true;
    120148        }
    121         else
    122         {
    123             COUT(2) << "A non-pending quest was trying to be failed." << std::endl;
    124         }
     149        COUT(2) << "A non-failable quest was trying to be failed." << std::endl;
     150        return false;
    125151    }
    126152   
     
    130156    @param player
    131157        The player.
     158    @return
     159        Returns true if the quest could be completed, false if not.
    132160    */
    133161    void Quest::complete(Player & player)
    134162    {
    135         if(this->isActive(player))
     163        if(this->isCompletable(player))
    136164        {
    137165            this->setStatus(player, questStatus::completed);
    138166            QuestEffect::invokeEffects(player, this->completeEffects_);
     167            return true;
    139168        }
    140         else
    141         {
    142             COUT(2) << "A non-pending quest was trying to be completed." << std::endl;
    143         }
     169        COUT(2) << "A non-completable quest was trying to be completed." << std::endl;
     170        return false;
    144171    }
    145172
Note: See TracChangeset for help on using the changeset viewer.