Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 30, 2008, 9:52:12 AM (16 years ago)
Author:
dafrick
Message:

Started with XMLPort…

File:
1 edited

Legend:

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

    r2043 r2068  
    2828
    2929#include "core/CoreIncludes.h"
     30#include "util/Exception.h"
    3031
    3132#include "GlobalQuest.h"
     
    3536    CreateFactory(GlobalQuest);
    3637
     38    /**
     39    @brief
     40        Constructor.
     41    */
    3742    GlobalQuest::GlobalQuest() : Quest()
    3843    {
    39        
     44        this->initialize();
    4045    }
    4146
     
    5055        The description of the quest.
    5156    */
    52     GlobalQuest::GlobalQuest(std::string id, std::string title, std::string description) : Quest(id, title, description)
     57    GlobalQuest::GlobalQuest(std::string id) : Quest(id)
    5358    {
    54         RegisterObject(GlobalQuest);
     59        this->initialize();
    5560    }
    5661   
     
    6469    }
    6570   
     71    void GlobalQuest::initialize(void)
     72    {
     73        RegisterObject(GlobalQuest);
     74    }
     75   
    6676    /**
    6777    @brief
     
    7181    @return
    7282        Returns true if the quest can be started, false if not.
     83    @throws
     84        Throws an exception if either isInactive() of isActive() throws one.
    7385    */
    7486    bool GlobalQuest::isStartable(const Player* player) const
    7587    {
    76         return this->isInactive(player) || this->isActive(player);
     88        return this->isInactive(player) ||  this->isActive(player);
    7789    }
    7890   
     
    8496    @return
    8597        Returns true if the quest can be failed, false if not.
     98    @throws
     99        Throws an Exception if isActive() throws one.
    86100    */
    87101    bool GlobalQuest::isFailable(const Player* player) const
    88102    {
    89103        return this->isActive(player);
     104
    90105    }
    91106   
     
    97112    @return
    98113        Returns true if the quest can be completed, false if not.
     114    @throws
     115        Throws an Exception if isActive() throws one.
    99116    */
    100117    bool GlobalQuest::isCompletable(const Player* player) const
     
    108125    @param player
    109126        The player.
     127    @throws
     128        Throws an Exception if player is NULL.
    110129    */
    111130    questStatus::Enum GlobalQuest::getStatus(const Player* player) const
    112131    {
     132        if(player == NULL)
     133        {
     134            ThrowException(Argument, "The input Player* is NULL.");
     135        }
     136       
    113137        //TDO: Does this really work???
    114138        std::set<Player*>::const_iterator it = this->players_.find((Player*)(void*)player);
     
    127151    @brief
    128152        Sets the status for a specific player.
     153        But be careful wit this one, the status will just be set without checking for its validity. You have to know what you're doing.
    129154    @param player
    130155        The player.
    131156    @param status
    132157        The status to be set.
     158    @return
     159        Returns false if player is NULL.
    133160    */
    134161    bool GlobalQuest::setStatus(Player* player, const questStatus::Enum & status)
    135162    {
     163        if(player == NULL)
     164        {
     165            return false;
     166        }
     167       
    136168        std::set<Player*>::const_iterator it = this->players_.find(player);
    137169        if (it == this->players_.end()) //!< Player is not yet in the list.
Note: See TracChangeset for help on using the changeset viewer.