Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 19, 2008, 4:06:09 PM (16 years ago)
Author:
dafrick
Message:

Resolved some issues, should be complete now.
Done some testing, no obvious errors uncovered.

Location:
code/branches/questsystem2/src/orxonox/objects/quest
Files:
12 edited

Legend:

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

    r2209 r2226  
    7373    {
    7474        SUPER(AddQuest, XMLPort, xmlelement, mode);
    75 
     75       
     76        COUT(3) << "New AddQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;
    7677    }
    7778
     
    9798        {
    9899            Quest* quest = QuestManager::findQuest(this->getQuestId());
    99             if(!quest->start(player))
     100            if(quest == NULL || !quest->start(player))
    100101            {
    101102               return false;
  • code/branches/questsystem2/src/orxonox/objects/quest/AddQuestHint.cc

    r2205 r2226  
    7474
    7575        XMLPortParam(AddQuestHint, "hintId", setHintId, getHintId, xmlelement, mode);
    76 
     76       
     77        COUT(3) << "New AddQuestHint, with target QuestHint {" << this->getHintId() << "}, created." << std::endl;
    7778    }
    7879
     
    113114        }
    114115
     116        COUT(3) << "AddQuestHint on player: " << player << " ." << std::endl;
     117
    115118        try
    116119        {
    117120            QuestHint* hint = QuestManager::findHint(this->hintId_);
    118             if(!hint->setActive(player))
     121            if(hint == NULL || !hint->setActive(player))
    119122            {
    120123                return false;
     
    127130        }
    128131
     132        COUT(3) << "QuestHint {" << this->getHintId() << "} successfully added to player." << std::endl;
    129133        return true;
    130134
  • code/branches/questsystem2/src/orxonox/objects/quest/AddReward.cc

    r2205 r2226  
    7070
    7171        XMLPortObject(AddReward, Rewardable, "", addRewardable, getRewardables, xmlelement, mode);
    72 
     72       
     73        COUT(3) << "New AddReward, with " << this->rewards_size() << " Rewardables created." << std::endl;
    7374    }
    7475
  • code/branches/questsystem2/src/orxonox/objects/quest/ChangeQuestStatus.cc

    r2191 r2226  
    6161    /**
    6262    @brief
     63        Method for creating a ChangeQuestStatus object through XML.
     64    */
     65    void ChangeQuestStatus::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     66    {
     67        SUPER(ChangeQuestStatus, XMLPort, xmlelement, mode);
     68
     69        XMLPortParam(ChangeQuestStatus, "questId", setQuestId, getQuestId, xmlelement, mode);
     70    }
     71
     72    /**
     73    @brief
    6374        Sets the id of the Quest the Questffect changes the status of.
    6475    @param id
     
    7990    }
    8091
    81     /**
    82     @brief
    83         Method for creating a ChangeQuestStatus object through XML.
    84     */
    85     void ChangeQuestStatus::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    86     {
    87         SUPER(ChangeQuestStatus, XMLPort, xmlelement, mode);
    88 
    89         XMLPortParam(ChangeQuestStatus, "questId", setQuestId, getQuestId, xmlelement, mode);
    90     }
    91 
    9292}
  • code/branches/questsystem2/src/orxonox/objects/quest/CompleteQuest.cc

    r2209 r2226  
    7171    {
    7272        SUPER(CompleteQuest, XMLPort, xmlelement, mode);
     73       
     74        COUT(3) << "New CompleteQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;
    7375    }
    7476
     
    9698        {
    9799            quest = QuestManager::findQuest(this->getQuestId());
    98             if(!quest->complete(player))
     100            if(quest == NULL || !quest->complete(player))
    99101            {
    100102               return false;
  • code/branches/questsystem2/src/orxonox/objects/quest/FailQuest.cc

    r2205 r2226  
    7171    {
    7272        SUPER(FailQuest, XMLPort, xmlelement, mode);
     73       
     74        COUT(3) << "New FailQUest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;
    7375    }
    7476
     
    8991        }
    9092
     93        COUT(3) << "FailQuest on player: " << player << " ." << std::endl;
     94
     95        Quest* quest;
    9196        try
    9297        {
    93             Quest* quest = QuestManager::findQuest(this->getQuestId());
    94             if(!quest->fail(player))
     98            quest = QuestManager::findQuest(this->getQuestId());
     99            if(quest == NULL || !quest->fail(player))
    95100            {
    96101               return false;
     
    102107            return false;
    103108        }
    104 
     109       
     110        COUT(3) << "Quest {" << quest->getId() << "} failed by player: " << player << " ." << std::endl;
    105111        return true;
    106112    }
  • code/branches/questsystem2/src/orxonox/objects/quest/GlobalQuest.cc

    r2205 r2226  
    147147    bool GlobalQuest::isStartable(const PlayerInfo* player) const
    148148    {
    149         return this->isInactive(player) ||  this->isActive(player);
     149        return (this->isInactive(player) && !(this->status_ == questStatus::completed || this->status_ == questStatus::failed));
    150150    }
    151151
  • code/branches/questsystem2/src/orxonox/objects/quest/GlobalQuest.h

    r2205 r2226  
    101101
    102102            virtual questStatus::Enum getStatus(const PlayerInfo* player) const; //!< Returns the status of the Quest for a specific player.
     103           
    103104            virtual bool setStatus(PlayerInfo* player, const questStatus::Enum & status); //!< Sets the status for a specific player.
    104105
  • code/branches/questsystem2/src/orxonox/objects/quest/Quest.cc

    r2205 r2226  
    7979        XMLPortObject(Quest, QuestEffect, "complete-effects", addCompleteEffect, getCompleteEffect, xmlelement, mode);
    8080
    81         QuestManager::registerQuest(this); //Registers the quest with the QuestManager.
     81        QuestManager::registerQuest(this); //!<Registers the Quest with the QuestManager.
    8282    }
    8383
  • code/branches/questsystem2/src/orxonox/objects/quest/QuestEffectBeacon.cc

    r2221 r2226  
    7979        XMLPortParam(QuestEffectBeacon, "times", setTimes, getTimes, xmlelement, mode);
    8080        XMLPortObject(QuestEffectBeacon, QuestEffect, "effects", addEffect, getEffect, xmlelement, mode);
     81       
     82        COUT(3) << "New QuestEffectBeacon created." << std::endl;
    8183    }
    8284   
     
    107109        if(!b)
    108110        {
    109             //TDO: Better message, please.
    110             COUT(2) << "b is false." << std::endl;
     111            return false;
    111112        }
    112113        if(!(this->isActive())) //!< If the QuestEffectBeacon is inactive it cannot be executed.
     
    126127        if(entity == NULL)
    127128        {
    128             COUT(2) << "No one triggered the beacon? Curious!" << std::endl;
     129            COUT(2) << "The QuestEffectBeacon was triggered by an entity other than a ControllableEntity." << std::endl;
    129130            return false;
    130131        }
  • code/branches/questsystem2/src/orxonox/objects/quest/QuestEffectBeacon.h

    r2221 r2226  
    7171            <events>
    7272                <execute>
    73                     <PlayerTrigger /> //A PlayerTrigger triggering the execution of the QuestEffectBeacon.
     73                    <EventListener event=eventIdString />
    7474                </execute>
    7575            </events>
     76            <attached>
     77               <PlayerTrigger name=eventIdString /> //A PlayerTrigger triggering the execution of the QuestEffectBeacon.
     78            </attached>
    7679        </QuestEffectBeacon>
    7780    @author
  • code/branches/questsystem2/src/orxonox/objects/quest/QuestHint.cc

    r2205 r2226  
    4040
    4141#include "orxonox/objects/infos/PlayerInfo.h"
     42#include "QuestManager.h"
    4243#include "Quest.h"
    4344
     
    7273        SUPER(QuestHint, XMLPort, xmlelement, mode);
    7374
     75        QuestManager::registerHint(this); //!< Registers the QuestHint with the QuestManager.
     76       
    7477        COUT(3) << "New QuestHint {" << this->getId() << "} created." << std::endl;
    7578    }
Note: See TracChangeset for help on using the changeset viewer.