Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2016, 10:29:21 PM (8 years ago)
Author:
landauf
Message:

merged branch cpp11_v3 back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/modules/objects/triggers/DistanceTrigger.cc

    r10624 r11071  
    106106            this->setForPlayer(true);
    107107
    108         if (targetId == NULL)
     108        if (targetId == nullptr)
    109109        {
    110110            orxout(internal_error, context::triggers) << "\"" << targetStr << "\" is not a valid class name to include in ClassTreeMask (in " << this->getName() << ", class " << this->getIdentifier()->getName() << ')' << endl;
     
    147147    {
    148148        // Check whether there is a cached object, it still exists and whether it is still in range, if so nothing further needs to be done.
    149         if(this->cache_ != NULL)
     149        if(this->cache_ != nullptr)
    150150        {
    151151            if((this->cache_->getWorldPosition() - this->getWorldPosition()).length() < this->distance_)
     
    158158        ClassTreeMask targetMask = this->targetMask_;
    159159        // If we are in identify-mode another target mask has to be applies to find the DistanceTriggerBeacons.
    160         if(this->beaconMode_ == distanceTriggerBeaconMode::identify)
     160        if(this->beaconMode_ == DistanceTriggerBeaconMode::identify)
    161161            targetMask = this->beaconMask_;
    162162
     
    167167
    168168            // If the DistanceTrigger is in identify-mode and the DistanceTriggerBeacon attached to the object has the wrong name we ignore it.
    169             if(this->beaconMode_ == distanceTriggerBeaconMode::identify)
     169            if(this->beaconMode_ == DistanceTriggerBeaconMode::identify)
    170170            {
    171171                if(entity->getName() != this->targetName_)
     
    177177
    178178            // If the DistanceTrigger is in exclude mode and the DistanceTriggerBeacon attached to the object has the right name, we ignore it.
    179             if(this->beaconMode_ == distanceTriggerBeaconMode::exclude)
     179            if(this->beaconMode_ == DistanceTriggerBeaconMode::exclude)
    180180            {
    181181
    182                 const std::set<WorldEntity*> attached = entity->getAttachedObjects();
     182                const std::set<WorldEntity*> attachedObjects = entity->getAttachedObjects();
    183183                bool found = false;
    184                 for(std::set<WorldEntity*>::const_iterator it = attached.begin(); it != attached.end(); it++)
     184                for(WorldEntity* attachedObject : attachedObjects)
    185185                {
    186                     if((*it)->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier()) && static_cast<DistanceTriggerBeacon*>(*it)->getName() == this->targetName_)
     186                    if(attachedObject->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier()) && static_cast<DistanceTriggerBeacon*>(attachedObject)->getName() == this->targetName_)
    187187                    {
    188188                        found = true;
     
    202202                {
    203203                    // Change the entity to the parent of the DistanceTriggerBeacon (if in identify-mode), which is the entity to which the beacon is attached.
    204                     if(this->beaconMode_ == distanceTriggerBeaconMode::identify)
     204                    if(this->beaconMode_ == DistanceTriggerBeaconMode::identify)
    205205                        entity = entity->getParent();
    206206
    207207                    Pawn* pawn = orxonox_cast<Pawn*>(entity);
    208                     if(pawn != NULL)
     208                    if(pawn != nullptr)
    209209                        this->setTriggeringPawn(pawn);
    210210                    else
    211                         orxout(internal_warning, context::triggers) << "Pawn was NULL." << endl;
     211                        orxout(internal_warning, context::triggers) << "Pawn was nullptr." << endl;
    212212                }
    213213               
     
    228228        The mode as an enum.
    229229    */
    230     void DistanceTrigger::setBeaconModeDirect(distanceTriggerBeaconMode::Value mode)
     230    void DistanceTrigger::setBeaconModeDirect(DistanceTriggerBeaconMode mode)
    231231    {
    232232        this->beaconMode_ = mode;
     
    243243        switch(this->getBeaconModeDirect())
    244244        {
    245             case distanceTriggerBeaconMode::off :
     245            case DistanceTriggerBeaconMode::off :
    246246                return DistanceTrigger::beaconModeOff_s;
    247             case distanceTriggerBeaconMode::identify:
     247            case DistanceTriggerBeaconMode::identify:
    248248                return DistanceTrigger::beaconModeIdentify_s;
    249             case distanceTriggerBeaconMode::exclude:
     249            case DistanceTriggerBeaconMode::exclude:
    250250                return DistanceTrigger::beaconModeExlcude_s;
    251251            default :
     
    264264    {
    265265        if(mode == DistanceTrigger::beaconModeOff_s)
    266             this->setBeaconModeDirect(distanceTriggerBeaconMode::off);
     266            this->setBeaconModeDirect(DistanceTriggerBeaconMode::off);
    267267        else if(mode == DistanceTrigger::beaconModeIdentify_s)
    268             this->setBeaconModeDirect(distanceTriggerBeaconMode::identify);
     268            this->setBeaconModeDirect(DistanceTriggerBeaconMode::identify);
    269269        else if(mode == DistanceTrigger::beaconModeExlcude_s)
    270             this->setBeaconModeDirect(distanceTriggerBeaconMode::exclude);
     270            this->setBeaconModeDirect(DistanceTriggerBeaconMode::exclude);
    271271        else
    272272            orxout(internal_error, context::triggers) << "Invalid beacon mode in DistanceTrigger." << endl;
     
    282282        Returns true if it is triggered ,false if not.
    283283    */
    284     bool DistanceTrigger::isTriggered(TriggerMode::Value mode)
     284    bool DistanceTrigger::isTriggered(TriggerMode mode)
    285285    {
    286286        if (Trigger::isTriggered(mode))
Note: See TracChangeset for help on using the changeset viewer.