Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 19, 2008, 11:50:03 AM (15 years ago)
Author:
dafrick
Message:

Some tweaks and solved some bugs…

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/questsystem2/src/orxonox/objects/quest/QuestEffectBeacon.h

    r2209 r2221  
    2727 */
    2828
     29/**
     30    @file QuestEffectBeacon.h
     31    @brief
     32        Definition of the QuestEffectBeacon class.
     33*/
     34
    2935#ifndef _QuestEffectBeacon_H__
    3036#define _QuestEffectBeacon_H__
     
    3743{
    3844
     45    //! The status of the beacon, can be either active or inactive.
    3946    enum Enum
    4047    {
     
    4249        active
    4350    };
    44    
     51
    4552}
    4653
     
    4956    /**
    5057    @brief
    51         A QuestEffectBeacon is an entity which can (under some condition(s)) invoke a number QuestEffects on players meeting the condition(s).
     58        A QuestEffectBeacon is a physical entity in the game which can (under some condition(s)) invoke a number QuestEffects on players meeting the condition(s).
    5259        The conditions under which the QuestEffects are invoked on the player are defined by Triggers.
    5360        A QuestEffectBeacon can be executed a defined number of times.
     61        A QuestEffectBeacon can be inactive or active.
     62       
     63        Creating a QuestEffectBeacon through XML goes as follows:
     64       
     65        <QuestEffectBeacon times=n> //Where 'n' is eighter a number >= 0, which means the QuestEffectBeacon can be executed n times. Or n = -1, which means the QuestEffectBeacon can be executed an infinite number of times.
     66            <effects>
     67                <QuestEffect /> //A list of QuestEffects, invoked when the QuestEffectBeacon is executed, see QuestEffect for the full XML representation.
     68                ...
     69                <QuestEffect />
     70            </effects>
     71            <events>
     72                <execute>
     73                    <PlayerTrigger /> //A PlayerTrigger triggering the execution of the QuestEffectBeacon.
     74                </execute>
     75            </events>
     76        </QuestEffectBeacon>
    5477    @author
    5578        Damian 'Mozork' Frick
     
    6184            virtual ~QuestEffectBeacon();
    6285           
    63             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     86            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestEffectBeacon object through XML.
    6487           
    65             virtual void processEvent(Event& event);
     88            virtual void processEvent(Event& event); //!< Processes an event for this QuestEffectBeacon.
    6689           
    6790            bool execute(bool b, PlayerTrigger* trigger); //!< Executes the QuestEffects of the QuestEffectBeacon.
    6891           
    69             bool isActive(void); //!< Test whether the QuestEffectBeacon is active.
     92            /**
     93            @brief Tests whether the QuestEffectBeacon is active.
     94            @return Returns true if the QuestEffectBeacon is active, fals if not.
     95            */
     96            inline bool isActive(void)
     97               { return this->status_ == QuestEffectBeaconStatus::active; }
     98           
     99            bool setActive(bool activate); //!< Set the status of the QuestEffectBeacon.
    70100           
    71101        protected:
    72102            bool decrementTimes(void); //!< Decrement the number of times the QuestEffectBeacon can still be executed.
    73103           
    74             inline const int & getTimes(void) const //!< Return the number of times the QUestEffectBeacon can still be executed.
     104            /**
     105            @brief Returns the number of times the QUestEffectBeacon can still be executed.
     106            @return Returns the number of times the QUestEffectBeacon can still be executed.
     107            */
     108            inline const int & getTimes(void) const
    75109                { return this->times_; }
    76110
    77111        private:
     112            static const int INFINITE = -1; //!< Constant to avoid using magic numbers.
     113       
    78114            std::list<QuestEffect*> effects_; //!< The list of QuestEffects to be invoked on the executing player.
    79115            int times_; //!< Number of times the beacon can be exectued.
    80116            QuestEffectBeaconStatus::Enum status_; //!< The status of the QUestEffectBeacon, Can be eighter active or inactive.
    81             PlayerTrigger* trigger_;
    82117           
    83118            bool setTimes(const int & n); //!< Set the number of times the QuestEffectBeacon can be executed.
    84             bool addEffect(QuestEffect* effect);
    85             bool addTrigger(PlayerTrigger* trigger);
     119            bool addEffect(QuestEffect* effect); //!< Add a QuestEffect to the QuestEffectBeacon.
    86120           
    87             const QuestEffect* getEffect(unsigned int index) const;
    88             const PlayerTrigger* getTrigger(unsigned int index) const;
     121            const QuestEffect* getEffect(unsigned int index) const; //!< Get the QuestEffect at a given index.
    89122   
    90123    };
Note: See TracChangeset for help on using the changeset viewer.