summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-05-10 11:09:03 -0600
committerJared Adams <jaxad0127@gmail.com>2009-05-10 11:09:03 -0600
commit46f42999a40f225400f9a0c5168e56ea8024395d (patch)
tree7ceb8e1247dcf11ee2718b66096fbef5f252e7a3
parent2f9d09c33429913c103b8832b1082df52f52607b (diff)
downloadmana-46f42999a40f225400f9a0c5168e56ea8024395d.tar.gz
mana-46f42999a40f225400f9a0c5168e56ea8024395d.tar.bz2
mana-46f42999a40f225400f9a0c5168e56ea8024395d.tar.xz
mana-46f42999a40f225400f9a0c5168e56ea8024395d.zip
Color player names more appropriately
Party memebrs use the party color. Text color for local player uses the local player color.
-rw-r--r--src/being.h2
-rw-r--r--src/player.cpp23
2 files changed, 19 insertions, 6 deletions
diff --git a/src/being.h b/src/being.h
index 72c0d8b2..4d1b0138 100644
--- a/src/being.h
+++ b/src/being.h
@@ -584,7 +584,7 @@ class Being : public Sprite, public ConfigListener
Uint16 mStunMode; /**< Stun mode; zero if not stunned */
std::set<int> mStatusEffects; /**< set of active status effects */
- const gcn::Color* mNameColor;
+ const gcn::Color *mNameColor;
std::vector<AnimatedSprite*> mSprites;
std::vector<int> mSpriteIDs;
diff --git a/src/player.cpp b/src/player.cpp
index 382008e2..d6f1a43f 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -31,6 +31,7 @@
#include "text.h"
#include "gui/palette.h"
+#include "gui/partywindow.h"
#include "resources/colordb.h"
#include "resources/itemdb.h"
@@ -68,15 +69,27 @@ void Player::setName(const std::string &name)
&guiPalette->getColor(Palette::GM_NAME));
}
else
- {
- mNameColor = &guiPalette->getColor(Palette::PLAYER);
+ {
+ const gcn::Color *color;
+ if (this == player_node)
+ {
+ color = mNameColor = &guiPalette->getColor(Palette::SELF);
+ }
+ else if (partyWindow->findMember(getId()))
+ {
+ color = mNameColor = &guiPalette->getColor(Palette::PARTY);
+ }
+ else
+ {
+ mNameColor = &guiPalette->getColor(Palette::PLAYER);
+ color = &guiPalette->getColor(Palette::PC);
+ }
+
mName = new FlashText(name,
getPixelX(),
getPixelY(),
gcn::Graphics::CENTER,
- (this == player_node) ?
- &guiPalette->getColor(Palette::SELF) :
- &guiPalette->getColor(Palette::PC));
+ color);
}
}
Being::setName(name);