Changeset af713bc in network-game


Ignore:
Timestamp:
Jul 15, 2013, 11:55:32 PM (11 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
9557f92
Parents:
3de664d
Message:

Fix a bug in cleanAckedMessages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • common/MessageProcessor.cpp

    r3de664d raf713bc  
    5757
    5858void MessageProcessor::cleanAckedMessages() {
    59    map<int, MessageContainer>::iterator it;
     59   map<int, MessageContainer>::iterator it = sentMessages.begin();
    6060
    61    for(it = sentMessages.begin(); it != sentMessages.end(); it++) {
     61   while (it != sentMessages.end()) {
    6262      if (it->second.isAcked && (getCurrentMillis() - it->second.timeAcked) > 1000)
    63          sentMessages.erase(it);
     63         it = sentMessages.erase(it);
     64      else
     65         it++;
    6466   }
    6567}
Note: See TracChangeset for help on using the changeset viewer.