Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 17, 2010, 10:50:43 PM (14 years ago)
Author:
dafrick
Message:

Resolving some TODOs and doing some additional cleanup. Almost done now…

File:
1 edited

Legend:

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

    r7456 r7552  
    9292    bool Quest::setParentQuest(Quest* quest)
    9393    {
    94         //TODO: Replace with assert.
    95         if(quest == NULL) // We don't want to set NULL-Pointers.
    96         {
    97             COUT(2) << "The parentquest to be added to quest {" << this->getId() << "} was NULL." << std::endl;
    98             return false;
    99         }
     94        assert(quest);
    10095
    10196        this->parentQuest_ = quest;
     
    115110    bool Quest::addSubQuest(Quest* quest)
    116111    {
    117         //TODO: Replace with assert.
    118         if(quest == NULL) // We don't want to set NULL-Pointers.
    119         {
    120             COUT(2) << "The subquest to be added to quest {" << this->getId() << "} was NULL." << std::endl;
    121             return false;
    122         }
     112        assert(quest);
    123113
    124114        quest->setParentQuest(this); // Sets the currentQuest (this) as parent-quest for the added sub-quest.
     
    140130    bool Quest::addHint(QuestHint* hint)
    141131    {
    142         //TODO: Replace with assert.
    143         if(hint == NULL) // We don't want to set NULL-Pointers. Seriously!
    144         {
    145             COUT(2) << "A NULL-QuestHint was trying to be added." << std::endl;
    146             return false;
    147         }
     132        assert(hint);
    148133
    149134        hint->setQuest(this); // Sets the current Quest (this) as Quest for the added QuestHint.
     
    164149    bool Quest::addFailEffect(QuestEffect* effect)
    165150    {
    166         //TODO: Replace with assert.
    167         if(effect == NULL) // We don't want to set NULL-Pointers.
    168         {
    169             COUT(2) << "A NULL-QuestEffect was trying to be added" << std::endl;
    170             return false;
    171         }
     151        assert(effect);
    172152
    173153        this->failEffects_.push_back(effect); // Adds the QuestEffect to the end of the list of fail QuestEffects.
     
    187167    bool Quest::addCompleteEffect(QuestEffect* effect)
    188168    {
    189         //TODO: Replace with assert.
    190         if(effect == NULL) // We don't want to set NULL-Pointers.
    191         {
    192             COUT(2) << "A NULL-QuestEffect was trying to be added" << std::endl;
    193             return false;
    194         }
     169        assert(effect);
    195170
    196171        this->completeEffects_.push_back(effect); // Adds the QuestEffect to the end of the list of complete QuestEffects.
     
    300275    @return
    301276        Returns true if the quest status for the specific player is 'inactive'.
    302     @throws
    303         Throws an exception if getStatus throws one.
    304277    */
    305278    bool Quest::isInactive(const PlayerInfo* player) const
    306279    {
     280        if(player == NULL)
     281            return true;
    307282        return this->getStatus(player) == QuestStatus::Inactive;
    308283    }
     
    315290    @return
    316291        Returns true if the quest status for the specific player is 'active'.
    317     @throws
    318         Throws an exception if getStatus throws one.
    319292    */
    320293    bool Quest::isActive(const PlayerInfo* player) const
    321294    {
     295        if(player == NULL)
     296            return false;
    322297        return this->getStatus(player) == QuestStatus::Active;
    323298    }
     
    330305    @return
    331306        Returns true if the quest status for the specific player is 'failed'.
    332     @throws
    333         Throws an exception if getStatus throws one.
    334307    */
    335308    bool Quest::isFailed(const PlayerInfo* player) const
    336309    {
     310        if(player == NULL)
     311            return false;
    337312        return this->getStatus(player) == QuestStatus::Failed;
    338313    }
     
    345320    @return
    346321        Returns true if the quest status for the specific player is 'completed'.
    347     @throws
    348         Throws an exception if getStatus throws one.
    349322    */
    350323    bool Quest::isCompleted(const PlayerInfo* player) const
    351324    {
     325        if(player == NULL)
     326            return false;
    352327        return this->getStatus(player) == QuestStatus::Completed;
    353328    }
     
    427402    bool Quest::addListener(QuestListener* listener)
    428403    {
    429         //TODO: Replace with assert?
    430         if(listener == NULL)
    431         {
    432             COUT(2) << "A NULL-QuestListener was trying to be added to a Quests listeners." << std::endl;
    433             return false;
    434         }
     404        assert(listener);
    435405
    436406        this->listeners_.push_back(listener);
Note: See TracChangeset for help on using the changeset viewer.