Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 12, 2008, 1:29:33 PM (17 years ago)
Author:
dafrick
Message:

Just changed some small stuff…

File:
1 edited

Legend:

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

    r2146 r2191  
    3232#include "core/CoreIncludes.h"
    3333#include "core/XMLPort.h"
     34#include "core/Event.h"
    3435
    3536#include "orxonox/objects/worldentities/ControllableEntity.h"
     37#include "orxonox/objects/worldentities/triggers/Trigger.h"
    3638#include "QuestEffect.h"
    3739
     
    4648        this->status_ = QuestEffectBeaconStatus::active;
    4749        this->times_ = -1;
     50        this->trigger_ = NULL;
    4851    }
    49 
    5052
    5153    QuestEffectBeacon::~QuestEffectBeacon()
     
    5860
    5961        XMLPortParam(QuestEffectBeacon, "times", setTimes, getTimes, xmlelement, mode);
    60         XMLPortObject(QuestEffectBeacon, QuestEffect, "", addEffect, getEffects, xmlelement, mode);
     62        XMLPortObject(QuestEffectBeacon, QuestEffect, "", addEffect, getEffect, xmlelement, mode);
     63        XMLPortObject(QuestEffectBeacon, Trigger, "", addTrigger, getTrigger, xmlelement, mode);
     64    }
     65   
     66    void processEvent(Event& event)
     67    {
     68        //TDO. Resolve pseudo code.
     69        //if(isControllableEntity(event.originator_))
     70        //{
     71        //    SetEvent(BaseObject, "activity", execute, event);
     72        //}
    6173    }
    6274   
     
    93105            return false;
    94106        }
    95         if(this->times_ == -1)
     107        if(this->getTimes() == -1)
    96108        {
    97109            return true;
     
    99111       
    100112        this->times_ = this->times_ - 1;
    101         if(this->times_ == 0)
     113        if(this->getTimes() == 0)
    102114        {
    103115            this->status_ = QuestEffectBeaconStatus::inactive;
     
    134146        this->effects_.push_back(effect);
    135147
    136         COUT(3) << "An effect was added to a QuestEffectBeacon." << std::endl;
     148        COUT(3) << "A QuestEffect was added to a QuestEffectBeacon." << std::endl;
    137149        return true;
     150    }
     151   
     152    bool QuestEffectBeacon::addTrigger(Trigger* trigger)
     153    {
     154        if(this->trigger_ != NULL)
     155        {
     156           COUT(2) << "A Trigger was trying to be added, where one was already set." << std::endl;
     157           return false;
     158        }
     159        if(trigger == NULL)
     160        {
     161            COUT(2) << "A NULL-Trigger was trying to be added." << std::endl;
     162            return false;
     163        }
     164       
     165        COUT(3) << "A Trigger was added to a QuestEffectBeacon." << std::endl;
     166        this->trigger_ = trigger;
     167        return true;
    138168    }
    139169   
     
    142172
    143173    */
    144     const QuestEffect* QuestEffectBeacon::getEffects(unsigned int index) const
     174    const QuestEffect* QuestEffectBeacon::getEffect(unsigned int index) const
    145175    {
    146176        int i = index;
     
    156186    }
    157187
     188    const Trigger* QuestEffectBeacon::getTrigger(unsigned int index) const
     189    {
     190        if(index == 0)
     191        {
     192            return this->trigger_;
     193        }
     194       
     195        return NULL;
     196    }
    158197
    159198}
Note: See TracChangeset for help on using the changeset viewer.