Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8675


Ignore:
Timestamp:
May 30, 2011, 12:14:57 AM (14 years ago)
Author:
dafrick
Message:

Fixing problems with beaconMask being NULL.

Location:
code/branches/presentation/src/modules/objects/triggers
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation/src/modules/objects/triggers/DistanceMultiTrigger.cc

    r8213 r8675  
    5353        Default Constructor. Registers the object and initializes default values.
    5454    */
    55     DistanceMultiTrigger::DistanceMultiTrigger(BaseObject* creator) : MultiTrigger(creator), beaconMask_(NULL)
     55    DistanceMultiTrigger::DistanceMultiTrigger(BaseObject* creator) : MultiTrigger(creator)
    5656    {
    5757        RegisterObject(DistanceMultiTrigger);
     
    6060        this->setBeaconModeDirect(distanceMultiTriggerBeaconMode::off);
    6161        this->targetName_ = "";
     62        this->beaconMask_.exclude(Class(BaseObject));
     63        this->beaconMask_.include(Class(DistanceTriggerBeacon));
    6264    }
    6365
     
    6870    DistanceMultiTrigger::~DistanceMultiTrigger()
    6971    {
    70         if(this->beaconMask_ != NULL)
    71             delete this->beaconMask_;
     72
    7273    }
    7374
     
    135136        // If we are in identify-mode another target mask has to be applies to find the DistanceTriggerBeacons.
    136137        if(this->beaconMode_ == distanceMultiTriggerBeaconMode::identify)
    137             targetMask = *this->beaconMask_;
     138            targetMask = this->beaconMask_;
    138139
    139140        // Iterate through all objects that are targets of the DistanceMultiTrigger.
     
    207208    {
    208209        this->beaconMode_ = mode;
    209         if(this->beaconMode_ == distanceMultiTriggerBeaconMode::identify && this->beaconMask_ == NULL)
    210         {
    211             this->beaconMask_ = new ClassTreeMask();
    212             this->beaconMask_->exclude(Class(BaseObject));
    213             this->beaconMask_->include(Class(DistanceTriggerBeacon));
    214         }
    215210    }
    216211   
  • code/branches/presentation/src/modules/objects/triggers/DistanceMultiTrigger.h

    r8213 r8675  
    152152            distanceMultiTriggerBeaconMode::Value beaconMode_; //!< The beacon mode, the DistanceMultiTrigger is in.
    153153            std::string targetName_; //!< The target name, used in <em>single-target</em> mode.
    154             ClassTreeMask* beaconMask_; //!< A mask, that only accepts DistanceTriggerBeacons.
     154            ClassTreeMask beaconMask_; //!< A mask, that only accepts DistanceTriggerBeacons.
    155155
    156156            std::map<WorldEntity*, WeakPtr<WorldEntity>* > range_; //!< The set of entities that currently are in range of the DistanceMultiTrigger.
  • code/branches/presentation/src/modules/objects/triggers/DistanceTrigger.cc

    r8667 r8675  
    5757        The creator of this trigger.
    5858    */
    59     DistanceTrigger::DistanceTrigger(BaseObject* creator) : Trigger(creator), beaconMask_(NULL)
     59    DistanceTrigger::DistanceTrigger(BaseObject* creator) : Trigger(creator)
    6060    {
    6161        RegisterObject(DistanceTrigger);
     
    6464        this->targetMask_.exclude(Class(BaseObject));
    6565        this->targetName_ = "";
     66        this->beaconMask_.exclude(Class(BaseObject));
     67        this->beaconMask_.include(Class(DistanceTriggerBeacon));
    6668    }
    6769
     
    7274    DistanceTrigger::~DistanceTrigger()
    7375    {
    74         // Delete the beacon mask if it exists.
    75         if(this->beaconMask_ != NULL)
    76             delete this->beaconMask_;
     76
    7777    }
    7878
     
    159159        // If we are in identify-mode another target mask has to be applies to find the DistanceTriggerBeacons.
    160160        if(this->beaconMode_ == distanceTriggerBeaconMode::identify)
    161             targetMask = *this->beaconMask_;
     161            targetMask = this->beaconMask_;
    162162
    163163        // Iterate through all objects that are targets of the DistanceTrigger.
     
    231231    {
    232232        this->beaconMode_ = mode;
    233         if(this->beaconMode_ == distanceTriggerBeaconMode::identify && this->beaconMask_ == NULL)
    234         {
    235             this->beaconMask_ = new ClassTreeMask();
    236             this->beaconMask_->exclude(Class(BaseObject));
    237             this->beaconMask_->include(Class(DistanceTriggerBeacon));
    238         }
    239233    }
    240234
  • code/branches/presentation/src/modules/objects/triggers/DistanceTrigger.h

    r8637 r8675  
    162162            distanceTriggerBeaconMode::Value beaconMode_; //!< The beacon mode.
    163163            std::string targetName_; //!< The name a DistanceTriggerBeacon needs to have to make the DistanceTrigger react to it if in beacon-mode.
    164             ClassTreeMask* beaconMask_; //!< A mask, that only accepts DistanceTriggerBeacons.
     164            ClassTreeMask beaconMask_; //!< A mask, that only accepts DistanceTriggerBeacons.
    165165           
    166166            WeakPtr<WorldEntity> cache_; //!< Caches the entity that triggered the DistanceTrigger last.
Note: See TracChangeset for help on using the changeset viewer.