summaryrefslogtreecommitdiff
path: root/src/gui/windows/whoisonline.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/windows/whoisonline.cpp')
-rw-r--r--src/gui/windows/whoisonline.cpp34
1 files changed, 12 insertions, 22 deletions
diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp
index a65f22e8d..2cb1c1e16 100644
--- a/src/gui/windows/whoisonline.cpp
+++ b/src/gui/windows/whoisonline.cpp
@@ -1,11 +1,11 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 Andrei Karas
* Copyright (C) 2011-2020 The ManaPlus Developers
- * Copyright (C) 2020-2023 The ManaVerse Developers
+ * Copyright (C) 2020-2025 The ManaVerse Developers
*
- * This file is part of The ManaPlus Client.
+ * This file is part of The ManaVerse Client.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -62,6 +62,7 @@
#include "utils/foreach.h"
#include "utils/gettext.h"
+#include "utils/performance.h"
#include "utils/sdlhelper.h"
#ifdef TMWA_SUPPORT
@@ -250,33 +251,22 @@ void WhoIsOnline::updateWindow(size_t numOnline)
std::sort(mFriends.begin(), mFriends.end(), nameCompare);
std::sort(mNeutral.begin(), mNeutral.end(), nameCompare);
std::sort(mDisregard.begin(), mDisregard.end(), nameCompare);
- bool addedFromSection(false);
FOR_EACH (STD_VECTOR<OnlinePlayer*>::const_iterator, it, mFriends)
- {
mBrowserBox->addRow((*it)->getText(), false);
- addedFromSection = true;
- }
- if (addedFromSection == true)
- {
+
+ if (!mFriends.empty())
mBrowserBox->addRow("---", false);
- addedFromSection = false;
- }
+
FOR_EACH (STD_VECTOR<OnlinePlayer*>::const_iterator, it, mEnemy)
- {
mBrowserBox->addRow((*it)->getText(), false);
- addedFromSection = true;
- }
- if (addedFromSection == true)
- {
+
+ if (!mEnemy.empty())
mBrowserBox->addRow("---", false);
- addedFromSection = false;
- }
+
FOR_EACH (STD_VECTOR<OnlinePlayer*>::const_iterator, it, mNeutral)
- {
mBrowserBox->addRow((*it)->getText(), false);
- addedFromSection = true;
- }
- if (addedFromSection == true && !mDisregard.empty())
+
+ if (!mNeutral.empty() && !mDisregard.empty())
mBrowserBox->addRow("---", false);
FOR_EACH (STD_VECTOR<OnlinePlayer*>::const_iterator, it, mDisregard)