The code in the emulator has several loops like this:
for(iterator=clients.begin(); iterator!=clients.end(); iterator++){
}
If you change the iterator inside the loop, specifically, if you erase something from the loop, then reset the iterator to clients.begin() you will apply the ++iterator PRIOR to the conditional statment. If the list size has been changed to 0 this should throw an exception (maybe it doesnt with release compile on but it should...) at any length it is more stable to use one of the following options:
--two loops( easier and good for list that are expected to be short)
bool change = true;
while(change){
change=false;
for(i=list.beign; i!=list.end &&!change; i++){
if(){
//make erase
change=true;
}
}
}
--other option is to use a toRemove list
List iterators.
Moderator: Team Members
-
LethalEncounter
- Team: Zombie
- Posts: 2717
- Joined: Wed Jul 25, 2007 10:10 pm
Who is online
Users browsing this forum: No registered users and 0 guests