diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-08-31 01:19:09 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-08-31 01:19:09 +0300 |
commit | 6d349121a70377723e53b92a8990e56ee3e4fd88 (patch) | |
tree | 78b99f93beedbaf939ab275cd8ddd5a4f061b497 /src | |
parent | e4687ac984a6b025548e58bbac8795001d07bff3 (diff) | |
download | plus-6d349121a70377723e53b92a8990e56ee3e4fd88.tar.gz plus-6d349121a70377723e53b92a8990e56ee3e4fd88.tar.bz2 plus-6d349121a70377723e53b92a8990e56ee3e4fd88.tar.xz plus-6d349121a70377723e53b92a8990e56ee3e4fd88.zip |
Always draw party members on same map in minimap.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/minimap.cpp | 48 | ||||
-rw-r--r-- | src/party.h | 6 |
2 files changed, 49 insertions, 5 deletions
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index dedf8077d..c3a4417f6 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -29,6 +29,7 @@ #include "localplayer.h" #include "logger.h" #include "map.h" +#include "party.h" #include "gui/userpalette.h" #include "gui/setup.h" @@ -275,10 +276,6 @@ void Minimap::draw(gcn::Graphics *graphics) { type = UserPalette::GM; } - else if (being->isInParty()) - { - type = UserPalette::PARTY; - } else if (being->getGuild() == player_node->getGuild() || being->getGuildName() == player_node->getGuildName()) { @@ -322,6 +319,49 @@ void Minimap::draw(gcn::Graphics *graphics) dotSize, dotSize)); } + if (player_node->isInParty()) + { + Party *party = player_node->getParty(); + if (party) + { + PartyMember *m = party->getMember(player_node->getName()); + Party::MemberList *members = party->getMembers(); + if (m && members) + { + const std::string curMap = m->getMap(); + Party::MemberList::const_iterator it = members->begin(); + const Party::MemberList::const_iterator + it_end = members->end(); + while (it != it_end) + { + PartyMember *member = *it; + if (member && member->getMap() == curMap + && member->getOnline() && member != m) + { + if (userPalette) + { + graphics->setColor(userPalette->getColor( + UserPalette::PARTY)); + } + + const int offsetHeight = static_cast<int>( + mHeightProportion); + const int offsetWidth = static_cast<int>( + mWidthProportion); + + graphics->fillRectangle(gcn::Rectangle( + static_cast<int>(member->getX() + * mWidthProportion) + mapOriginX - offsetWidth, + static_cast<int>(member->getY() + * mHeightProportion) + mapOriginY - offsetHeight, + 2, 2)); + } + ++ it; + } + } + } + } + const Vector &pos = player_node->getPosition(); // logger->log("width:" + toString(graph->getWidth())); diff --git a/src/party.h b/src/party.h index 466f63a19..e286a794a 100644 --- a/src/party.h +++ b/src/party.h @@ -149,6 +149,11 @@ public: void sort(); + typedef std::vector<PartyMember*> MemberList; + + MemberList *getMembers() + { return &mMembers; } + static Party *getParty(short id); static void clearParties(); @@ -164,7 +169,6 @@ private: ~Party(); - typedef std::vector<PartyMember*> MemberList; MemberList mMembers; std::string mName; short mId; |