From b3674f2ea544a27e08eaa2275b2ad5a9e9bb117d Mon Sep 17 00:00:00 2001 From: Kai Philipp Date: Mon, 9 Sep 2019 23:01:04 +0200 Subject: [PATCH] another iteration try --- src/net/common/sessiondata.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/net/common/sessiondata.cpp b/src/net/common/sessiondata.cpp index a8114682..41b0fe5c 100644 --- a/src/net/common/sessiondata.cpp +++ b/src/net/common/sessiondata.cpp @@ -404,14 +404,14 @@ SessionData::GetPlayerData() } void -SessionData::SetPlayerLastGames(std::vector lastGames) +SessionData::SetPlayerLastGames(std::vector lastGames) { boost::mutex::scoped_lock lock(m_dataMutex); m_lastGames = lastGames; } void -SessionData::AddPlayerLastGame(long lastGame) +SessionData::AddPlayerLastGame(unsigned long lastGame) { boost::mutex::scoped_lock lock(m_dataMutex); @@ -420,7 +420,7 @@ SessionData::AddPlayerLastGame(long lastGame) // @TODO: remove overdued entries } -std::vector +std::vector SessionData::GetPlayerLastGames() { boost::mutex::scoped_lock lock(m_dataMutex); @@ -443,13 +443,12 @@ SessionData::IsPlayerAllowedToJoinLimitRank() long num = (long)SERVER_ALLOWED_RANKING_GAMES_PER_MINUTES; long count = 0; - auto timeStamp = m_lastGames.begin(); - while (timeStamp != m_lastGames.end()) - { - if((long)timeStamp > then) + + for(std::vector::iterator timeStamp = m_lastGames.begin(); timeStamp != m_lastGames.end(); ++timeStamp) { + if(*timeStamp > then) count++; else - m_lastGames.erase(timeStamp); + m_lastGames.erase(*timeStamp); } if(count < num)