Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 29, 2010, 3:40:02 PM (15 years ago)
Author:
dafrick
Message:

DistanceMultiTrigger fix. Thanks to Fabian.

File:
1 edited

Legend:

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

    r6800 r6807  
    8585        }
    8686       
    87         for(std::set<WorldEntity*>::iterator it = this->range_.begin(); it != this->range_.end(); it++)
     87        for(std::set<WorldEntity*>::iterator it = this->range_.begin(); it != this->range_.end(); )
    8888        {
    8989            Vector3 distanceVec = (*it)->getWorldPosition() - this->getWorldPosition();
    9090            if (distanceVec.length() >= this->distance_)
    9191            {
    92                 if(!this->removeFromRange(*it))
     92                WorldEntity* temp = *(it++);
     93                if(!this->removeFromRange(temp))
    9394                    continue;
    9495               
     
    99100                MultiTriggerState* state = new MultiTriggerState;
    100101                state->bTriggered = false;
    101                 state->originator = *it;
     102                state->originator = temp;
    102103                queue->push(state);
    103104            }
     105            else
     106                ++it;
    104107        }
    105108       
Note: See TracChangeset for help on using the changeset viewer.