bugfix vector erase

This commit is contained in:
Kai Philipp
2019-09-14 17:43:32 +02:00
parent 66169137a5
commit 5bd3d84bc2
+4 -3
View File
@@ -283,12 +283,13 @@ LOG_ERROR("checking IsPlayerAllowedToJoinCreateLimitRank() ");
long then = (long)time(NULL) - (long)(SERVER_ALLOWED_RANKING_GAMES_MINUTES * 10);
int count = 0;
int i=0;
for(std::vector<long>::iterator timeStamp = m_last_games.begin(); timeStamp != m_last_games.end(); ++timeStamp) {
if(*timeStamp > then)
count++;
//else
//m_last_games.erase(timeStamp); // erase overdued entries
else
m_last_games.erase(m_last_games.begin() + i); // erase overdued entries
i++;
}
if(count < SERVER_ALLOWED_RANKING_GAMES_PER_MINUTES)