diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-12-02 07:12:57 -0700 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-12-02 07:13:37 -0700 |
commit | d12c93d4d6fc38eb86b5cb8515f4b8f8a7e96b54 (patch) | |
tree | c5fa5507e4766bef7bf09e20e17d3294fdd6d6e5 /src/gui/partywindow.cpp | |
parent | b3c59dafe02c5c060bb1d8de7040b3a3ee73da44 (diff) | |
download | mana-d12c93d4d6fc38eb86b5cb8515f4b8f8a7e96b54.tar.gz mana-d12c93d4d6fc38eb86b5cb8515f4b8f8a7e96b54.tar.bz2 mana-d12c93d4d6fc38eb86b5cb8515f4b8f8a7e96b54.tar.xz mana-d12c93d4d6fc38eb86b5cb8515f4b8f8a7e96b54.zip |
Simplify PartyMember by moving fields into Avatar
Diffstat (limited to 'src/gui/partywindow.cpp')
-rw-r--r-- | src/gui/partywindow.cpp | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/gui/partywindow.cpp b/src/gui/partywindow.cpp index d4b084ce..151e148c 100644 --- a/src/gui/partywindow.cpp +++ b/src/gui/partywindow.cpp @@ -35,13 +35,19 @@ #include "utils/stringutils.h" PartyMember::PartyMember(): - avatar(new Avatar) + mAvatar(new Avatar) { } PartyMember::~PartyMember() { - delete avatar; + delete mAvatar; +} + +void PartyMember::setLeader(bool leader) +{ + mLeader = leader; + mAvatar->setDisplayBold(true); } @@ -108,7 +114,7 @@ int PartyWindow::findMember(const std::string &name) const while (itr != itr_end) { - if ((*itr).second->name == name) + if ((*itr).second->mAvatar->getName() == name) { return (*itr).first; } @@ -122,12 +128,9 @@ void PartyWindow::updateMember(int id, const std::string &memberName, bool leader, bool online) { PartyMember *member = findOrCreateMember(id); - member->name = memberName; - member->leader = leader; - member->online = online; - member->avatar->setDisplayBold(leader); - member->avatar->setName(memberName); - member->avatar->setOnline(online); + member->mAvatar->setName(memberName); + member->setLeader(leader); + member->mAvatar->setOnline(online); Player *player = dynamic_cast<Player*>(beingManager->findBeing(id)); if (player && online) @@ -137,8 +140,8 @@ void PartyWindow::updateMember(int id, const std::string &memberName, void PartyWindow::updateMemberHP(int id, int hp, int maxhp) { PartyMember *player = findOrCreateMember(id); - player->avatar->setHp(hp); - player->avatar->setMaxHp(maxhp); + player->mAvatar->setHp(hp); + player->mAvatar->setMaxHp(maxhp); } void PartyWindow::removeMember(int id) @@ -163,8 +166,7 @@ void PartyWindow::updateOnlne(int id, bool online) if (!player) return; - player->online = online; - player->avatar->setOnline(online); + player->mAvatar->setOnline(online); } void PartyWindow::showPartyInvite(const std::string &inviter, @@ -245,7 +247,7 @@ void PartyWindow::buildLayout() for (it = mMembers.begin(); it != mMembers.end(); it++) { member = (*it).second; - add(member->avatar, 0, lastPos); - lastPos += member->avatar->getHeight() + 2; + add(member->mAvatar, 0, lastPos); + lastPos += member->mAvatar->getHeight() + 2; } } |