summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-01-22 20:57:37 +0300
committerAndrei Karas <akaras@inbox.ru>2013-01-22 20:57:37 +0300
commit4d5746331c6e4beee730e4b67df26e65bbc1001e (patch)
tree43a40f058b9ada5940a599fc8f7e93c43c90845d /src
parent1295d37475ec737930cc222953d773f79d8d8eba (diff)
downloadplus-4d5746331c6e4beee730e4b67df26e65bbc1001e.tar.gz
plus-4d5746331c6e4beee730e4b67df26e65bbc1001e.tar.bz2
plus-4d5746331c6e4beee730e4b67df26e65bbc1001e.tar.xz
plus-4d5746331c6e4beee730e4b67df26e65bbc1001e.zip
Show in online list colored party and guild members.
Diffstat (limited to 'src')
-rw-r--r--src/gui/whoisonline.cpp69
-rw-r--r--src/gui/whoisonline.h2
2 files changed, 65 insertions, 6 deletions
diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp
index 73dcf008a..893b27a46 100644
--- a/src/gui/whoisonline.cpp
+++ b/src/gui/whoisonline.cpp
@@ -22,10 +22,8 @@
#include "gui/whoisonline.h"
-#include <SDL.h>
-#include <SDL_thread.h>
-#include <vector>
-#include <algorithm>
+#include "guild.h"
+#include "party.h"
#include "gui/socialwindow.h"
#include "gui/viewport.h"
@@ -49,6 +47,11 @@
#include "utils/dtor.h"
#include "utils/gettext.h"
+#include <SDL.h>
+#include <SDL_thread.h>
+#include <vector>
+#include <algorithm>
+
// Curl should be included after Guichan to avoid Windows redefinitions
#include <curl/curl.h>
@@ -263,7 +266,7 @@ void WhoIsOnline::loadList(std::vector<OnlinePlayer*> &list)
{
case PlayerRelation::NEUTRAL:
default:
- player->setText("0");
+ setNeutralColor(player);
neutral.push_back(player);
break;
@@ -411,7 +414,7 @@ void WhoIsOnline::loadWebList()
{
case PlayerRelation::NEUTRAL:
default:
- player->setText("0");
+ setNeutralColor(player);
neutral.push_back(player);
break;
@@ -722,6 +725,60 @@ void WhoIsOnline::optionChanged(const std::string &name)
mGroupFriends = config.getBoolValue("groupFriends");
}
+void WhoIsOnline::setNeutralColor(OnlinePlayer *const player)
+{
+ if (!player)
+ return;
+
+ if (actorSpriteManager && player_node)
+ {
+ const std::string &nick = player->getNick();
+ if (player_node->isInParty())
+ {
+ const Party *const party = player_node->getParty();
+ if (party)
+ {
+ if (party->getMember(nick))
+ {
+ player->setText("P");
+ return;
+ }
+ }
+ }
+
+ const Being *const being = actorSpriteManager->findBeingByName(nick);
+ if (being)
+ {
+ const Guild *const guild2 = player_node->getGuild();
+ if (guild2)
+ {
+ const Guild *const guild1 = being->getGuild();
+ if (guild1)
+ {
+ if (guild1->getId() == guild2->getId()
+ || guild2->getMember(nick))
+ {
+ player->setText("U");
+ return;
+ }
+ }
+ else if (guild2->isMember(nick))
+ {
+ player->setText("U");
+ return;
+ }
+ }
+ }
+ const Guild *const guild3 = Guild::getGuild(1);
+ if (guild3 && guild3->isMember(nick))
+ {
+ player->setText("U");
+ return;
+ }
+ }
+ player->setText("0");
+}
+
void OnlinePlayer::setText(std::string color)
{
mText.clear();
diff --git a/src/gui/whoisonline.h b/src/gui/whoisonline.h
index fa2955e40..6ee9a9c9d 100644
--- a/src/gui/whoisonline.h
+++ b/src/gui/whoisonline.h
@@ -152,6 +152,8 @@ public:
void readFromWeb();
+ void setNeutralColor(OnlinePlayer *const player);
+
private:
void download();