diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-05-12 20:30:46 +0200 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-05-12 20:31:24 +0200 |
commit | c6a2f58d221247456946100082a580cce9733917 (patch) | |
tree | 36c3f43d1ea5973537613cf761a3300689c5d31b | |
parent | 057c4592a0260af3efca3f7871abf24d8ed77c5d (diff) | |
download | mana-c6a2f58d221247456946100082a580cce9733917.tar.gz mana-c6a2f58d221247456946100082a580cce9733917.tar.bz2 mana-c6a2f58d221247456946100082a580cce9733917.tar.xz mana-c6a2f58d221247456946100082a580cce9733917.zip |
Some small cleanups and fixed compile with tmwserv support
-rw-r--r-- | src/gui/minimap.cpp | 2 | ||||
-rw-r--r-- | src/gui/partywindow.cpp | 10 | ||||
-rw-r--r-- | src/gui/partywindow.h | 2 | ||||
-rw-r--r-- | src/localplayer.h | 5 | ||||
-rw-r--r-- | src/net/tmwserv/partyhandler.cpp | 2 | ||||
-rw-r--r-- | src/player.cpp | 9 | ||||
-rw-r--r-- | src/player.h | 10 | ||||
-rw-r--r-- | src/playerrelations.cpp | 10 |
8 files changed, 23 insertions, 27 deletions
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 160c0722..a5bdc59d 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -181,7 +181,7 @@ void Minimap::draw(gcn::Graphics *graphics) { case Being::PLAYER: { - const Player* player = static_cast<const Player*>(being); + const Player *player = static_cast<const Player*>(being); Palette::ColorType type = Palette::PC; diff --git a/src/gui/partywindow.cpp b/src/gui/partywindow.cpp index 52a7b97e..317811ee 100644 --- a/src/gui/partywindow.cpp +++ b/src/gui/partywindow.cpp @@ -65,7 +65,7 @@ PartyWindow::~PartyWindow() delete_all(mMembers); } -void PartyWindow::setPartyName(std::string name) +void PartyWindow::setPartyName(const std::string &name) { setCaption(strprintf(_("Party (%s)"), name.c_str())); } @@ -125,8 +125,7 @@ void PartyWindow::updateMember(int id, const std::string &memberName, member->avatar->setName(memberName); member->avatar->setOnline(online); - Player *player = dynamic_cast<Player*>(beingManager->findBeing(id)); - if (player) + if (Player *player = dynamic_cast<Player*>(beingManager->findBeing(id))) player->setInParty(true); } @@ -141,8 +140,7 @@ void PartyWindow::removeMember(int id) { mMembers.erase(id); - Player *player = dynamic_cast<Player*>(beingManager->findBeing(id)); - if (player) + if (Player *player = dynamic_cast<Player*>(beingManager->findBeing(id))) player->setInParty(false); } @@ -210,7 +208,7 @@ void PartyWindow::action(const gcn::ActionEvent &event) } } -void clearMembersSub(std::pair<int, PartyMember*> p) +void clearMembersSub(const std::pair<int, PartyMember*> &p) { Player *player = dynamic_cast<Player*>(beingManager->findBeing(p.first)); if (player) diff --git a/src/gui/partywindow.h b/src/gui/partywindow.h index c3fe75f4..8cea500f 100644 --- a/src/gui/partywindow.h +++ b/src/gui/partywindow.h @@ -65,7 +65,7 @@ class PartyWindow : public Window, gcn::ActionListener */ ~PartyWindow(); - void setPartyName(std::string name); + void setPartyName(const std::string &name); void clearPartyName(); diff --git a/src/localplayer.h b/src/localplayer.h index 52e2b74b..bab254ab 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -280,10 +280,7 @@ class LocalPlayer : public Player */ bool withinAttackRange(Being *target); -#ifdef EATHENA_SUPPORT - //void raiseSkill(Uint16 skillId); -#else - +#ifdef TMWSERV_SUPPORT /** * Stops the player dead in his tracks */ diff --git a/src/net/tmwserv/partyhandler.cpp b/src/net/tmwserv/partyhandler.cpp index 01de1be8..47ef791c 100644 --- a/src/net/tmwserv/partyhandler.cpp +++ b/src/net/tmwserv/partyhandler.cpp @@ -99,7 +99,7 @@ void PartyHandler::handleMessage(MessageIn &msg) localChatTab->chatLog(name + " joined the party"); - if (!player_node->getInParty()) + if (!player_node->isInParty()) player_node->setInParty(true); partyWindow->updateMember(id, name); diff --git a/src/player.cpp b/src/player.cpp index e797fdfe..b7370e03 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -300,12 +300,15 @@ short Player::getNumberOfGuilds() #endif -void Player::setInParty(bool value) +void Player::setInParty(bool inParty) { - mInParty = value; + mInParty = inParty; if (this != player_node && mName) - mName->setColor(&guiPalette->getColor(value ? Palette::PARTY : Palette::PC)); + { + Palette::ColorType colorType = mInParty ? Palette::PARTY : Palette::PC; + mName->setColor(&guiPalette->getColor(colorType)); + } } void Player::optionChanged(const std::string &value) diff --git a/src/player.h b/src/player.h index af6412d4..330d0c14 100644 --- a/src/player.h +++ b/src/player.h @@ -120,13 +120,12 @@ class Player : public Being #endif /** - * Set the player in party + * Set whether the player in the LocalPlayer's party. Players that are + * in the same party as the local player get their name displayed in + * a different color. */ - void setInParty(bool value); + void setInParty(bool inParty); - /** - * Returns whether player is in the party - */ bool isInParty() const { return mInParty; } /** @@ -138,7 +137,6 @@ class Player : public Being /** * Called when a option (set with config.addListener()) is changed */ - void optionChanged(const std::string &value); protected: diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp index a14861ef..316bd9ed 100644 --- a/src/playerrelations.cpp +++ b/src/playerrelations.cpp @@ -203,7 +203,8 @@ bool PlayerRelationsManager::hasPermission(Being *being, unsigned int flags) return true; } -bool PlayerRelationsManager::hasPermission(const std::string &name, unsigned int flags) +bool PlayerRelationsManager::hasPermission(const std::string &name, + unsigned int flags) { unsigned int rejections = flags & ~checkPermissionSilently(name, flags); bool permitted = rejections == 0; @@ -214,8 +215,7 @@ bool PlayerRelationsManager::hasPermission(const std::string &name, unsigned int Player *to_ignore = dynamic_cast<Player *>(beingManager->findBeingByName(name, Being::PLAYER)); if (to_ignore) - mIgnoreStrategy->ignore(to_ignore, - rejections); + mIgnoreStrategy->ignore(to_ignore, rejections); } } @@ -297,8 +297,8 @@ public: } virtual void ignore(Player *player, unsigned int flags) - { - } + { + } }; class PIS_dotdotdot : public PlayerIgnoreStrategy |