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/worldentities/triggers/DistanceTrigger.cc

    r2209 r2221  
    3535#include "core/XMLPort.h"
    3636
     37#include "orxonox/objects/worldentities/ControllableEntity.h"
     38
    3739namespace orxonox
    3840{
     
    4547    this->distance_ = 100;
    4648    this->targetMask_.exclude(Class(BaseObject));
    47     this->setForPlayer(false);
     49    this->setForPlayer(false); //!< Normally hasn't just ControllableEntities as targets.
    4850  }
    4951
     
    8385  void DistanceTrigger::addTargets(const std::string& targets)
    8486  {
    85  
    86     if(targets == "ControllableEntity")
     87    Identifier* targetId = ClassByString(targets);
     88   
     89    //! Checks whether the target is (or is derived from) a ControllableEntity.
     90    Identifier* controllableEntityId = Class(ControllableEntity);
     91    if(targetId->isA(controllableEntityId))
    8792    {
    88         this->setForPlayer(true);
     93      this->setForPlayer(true);
    8994    }
    90  
    91     Identifier* targetId = ClassByString(targets);
     95   
    9296    if (!targetId)
    9397    {
     
    125129      if (distanceVec.length() < this->distance_)
    126130      {
     131       
     132        //! If the target is a player (resp. is a, or is derived from a, ControllableEntity) the triggeringPlayer is set to the target entity.
    127133        if(this->isForPlayer())
    128134        {
    129             ControllableEntity* player = dynamic_cast<ControllableEntity*>(entity);
    130             this->setTriggeringPlayer(player);
     135          ControllableEntity* player = dynamic_cast<ControllableEntity*>(entity);
     136          this->setTriggeringPlayer(player);
    131137        }
    132138       
Note: See TracChangeset for help on using the changeset viewer.