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/LocalQuest.cc

    r2043 r2068  
    2828
    2929#include "core/CoreIncludes.h"
     30#include "util/Exception.h"
    3031
    3132#include "LocalQuest.h"
     
    3738    LocalQuest::LocalQuest() : Quest()
    3839    {
    39        
     40        this->initialize();
    4041    }
    4142
     
    4546    @param id
    4647        The unique identifier.
    47     @param title
    48         The title of the quest.
    49     @param description
    50         The description of the quest.
    5148    */
    52     LocalQuest::LocalQuest(std::string id, std::string title, std::string description) : Quest(id, title, description)
     49    LocalQuest::LocalQuest(std::string id) : Quest(id)
    5350    {
    54         RegisterObject(LocalQuest);
     51        this->initialize();
    5552    }
    5653   
     
    6461    }
    6562   
     63    void LocalQuest::initialize(void)
     64    {
     65        RegisterObject(LocalQuest);
     66    }
     67   
    6668    /**
    6769    @brief
     
    7173    @return
    7274        Returns true if the quest can be started, false if not.
     75    @throws
     76        Throws an exception if isInactive(Player*) throws one.
    7377    */
    7478    bool LocalQuest::isStartable(const Player* player) const
     
    8488    @return
    8589        Returns true if the quest can be failed, false if not.
     90    @throws
     91        Throws an exception if isActive(Player*) throws one.
    8692    */
    8793    bool LocalQuest::isFailable(const Player* player) const
     
    97103    @return
    98104        Returns true if the quest can be completed, false if not.
     105    @throws
     106        Throws an exception if isInactive(Player*) throws one.
    99107    */
    100108    bool LocalQuest::isCompletable(const Player* player) const
     
    110118    @return
    111119        Returns the status of the quest for the input player.
     120    @throws
     121        Throws an Exception if player is NULL.
    112122    */
    113123    questStatus::Enum LocalQuest::getStatus(const Player* player) const
    114124    {
     125        if(player == NULL)
     126        {
     127            ThrowException(Argument, "The input Player* is NULL.");
     128        }
     129       
    115130        std::map<Player*, questStatus::Enum>::const_iterator it = this->playerStatus_.find((Player*)(void*)player); //Thx. to x3n for the (Player*)(void*) 'hack'.
    116131        if (it != this->playerStatus_.end())
     
    124139    @brief
    125140        Sets the status for a specific player.
     141        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.
    126142    @param player
    127143        The player.
    128144    @param status
    129145        The status.
     146    @return
     147        Returns false if player is NULL.
    130148    */
    131149    bool LocalQuest::setStatus(Player* player, const questStatus::Enum & status)
    132150    {
     151        if(player == NULL)
     152        {
     153            return false;
     154        }
    133155        this->playerStatus_[player] = status;
    134156        return true;
Note: See TracChangeset for help on using the changeset viewer.