summaryrefslogtreecommitdiff
path: root/src/gui/whoisonline.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-04-25 02:26:22 +0300
committerAndrei Karas <akaras@inbox.ru>2012-04-25 02:26:22 +0300
commit8e19f9b9d792cf4d3d3b022fd26a258c3d3d97bf (patch)
tree2c95704e2de3418227faf7a52357a6fe03d5b735 /src/gui/whoisonline.cpp
parente73f7da4d65e7dc61a952894cc6f0843c4da3170 (diff)
downloadmanaplus-8e19f9b9d792cf4d3d3b022fd26a258c3d3d97bf.tar.gz
manaplus-8e19f9b9d792cf4d3d3b022fd26a258c3d3d97bf.tar.bz2
manaplus-8e19f9b9d792cf4d3d3b022fd26a258c3d3d97bf.tar.xz
manaplus-8e19f9b9d792cf4d3d3b022fd26a258c3d3d97bf.zip
Improve iterators part 1.
Diffstat (limited to 'src/gui/whoisonline.cpp')
-rw-r--r--src/gui/whoisonline.cpp29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp
index b9b692c0f..a7cbca7cc 100644
--- a/src/gui/whoisonline.cpp
+++ b/src/gui/whoisonline.cpp
@@ -143,11 +143,11 @@ WhoIsOnline::~WhoIsOnline()
// Remove possibly leftover temporary download
delete []mCurlError;
- std::set<OnlinePlayer*>::iterator itd = mOnlinePlayers.begin();
- std::set<OnlinePlayer*>::iterator itd_end = mOnlinePlayers.end();
-
- for (; itd != itd_end; ++ itd)
+ for (std::set<OnlinePlayer*>::iterator itd = mOnlinePlayers.begin(),
+ itd_end = mOnlinePlayers.end(); itd != itd_end; ++ itd)
+ {
delete *itd;
+ }
mOnlinePlayers.clear();
mOnlineNicks.clear();
}
@@ -253,19 +253,18 @@ void WhoIsOnline::loadList(std::vector<OnlinePlayer*> &list)
std::vector<OnlinePlayer*> disregard;
std::vector<OnlinePlayer*> enemy;
- std::set<OnlinePlayer*>::iterator itd = mOnlinePlayers.begin();
- std::set<OnlinePlayer*>::iterator itd_end = mOnlinePlayers.end();
-
- for (; itd != itd_end; ++ itd)
+ for (std::set<OnlinePlayer*>::iterator itd = mOnlinePlayers.begin(),
+ itd_end = mOnlinePlayers.end(); itd != itd_end; ++ itd)
+ {
delete *itd;
+ }
mOnlinePlayers.clear();
mOnlineNicks.clear();
mShowLevel = config.getBoolValue("showlevel");
- std::vector<OnlinePlayer*>::iterator it = list.begin();
- std::vector<OnlinePlayer*>::iterator it_end = list.end();
- for (; it != it_end; ++ it)
+ for (std::vector<OnlinePlayer*>::const_iterator it = list.begin(),
+ it_end = list.end(); it != it_end; ++ it)
{
OnlinePlayer *player = *it;
std::string nick = player->getNick();
@@ -342,11 +341,11 @@ void WhoIsOnline::loadWebList()
char *line = strtok(mMemoryBuffer, "\n");
const std::string gmText = "(GM)";
- std::set<OnlinePlayer*>::iterator itd = mOnlinePlayers.begin();
- std::set<OnlinePlayer*>::iterator itd_end = mOnlinePlayers.end();
-
- for (; itd != itd_end; ++ itd)
+ for (std::set<OnlinePlayer*>::iterator itd = mOnlinePlayers.begin(),
+ itd_end = mOnlinePlayers.end(); itd != itd_end; ++ itd)
+ {
delete *itd;
+ }
mOnlinePlayers.clear();
mOnlineNicks.clear();