diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-04-07 19:22:02 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-04-07 21:38:21 +0300 |
commit | e7d34cc22d3bfd0dd44b014af1bd5fdc891141aa (patch) | |
tree | f7fa5a490a99cd4c08d051f44154d5d0e4d26222 /src | |
parent | ffeffa2314dbe03e0ced58e0c465760b54908690 (diff) | |
download | ManaVerse-e7d34cc22d3bfd0dd44b014af1bd5fdc891141aa.tar.gz ManaVerse-e7d34cc22d3bfd0dd44b014af1bd5fdc891141aa.tar.bz2 ManaVerse-e7d34cc22d3bfd0dd44b014af1bd5fdc891141aa.tar.xz ManaVerse-e7d34cc22d3bfd0dd44b014af1bd5fdc891141aa.zip |
fix more style, add consts.
Diffstat (limited to 'src')
34 files changed, 48 insertions, 33 deletions
diff --git a/src/being.h b/src/being.h index 43bb3b188..02d3db68e 100644 --- a/src/being.h +++ b/src/being.h @@ -275,7 +275,7 @@ class Being : public ActorSprite, public ConfigListener * @param damage the amount of damage dealt (0 means miss) * @param type the attack type */ - virtual void handleAttack(Being *const victim, const int damage, + void handleAttack(Being *const victim, const int damage, const int attackId = 1); virtual void handleSkill(Being *const victim, const int damage, @@ -373,7 +373,7 @@ class Being : public ActorSprite, public ConfigListener void updateGuild(); - Party *getParty() const + Party *getParty() const A_WARN_UNUSED { return mParty; } int getSpritesCount() const A_WARN_UNUSED diff --git a/src/graphics.h b/src/graphics.h index 12a6c3a77..ff5d47580 100644 --- a/src/graphics.h +++ b/src/graphics.h @@ -291,7 +291,7 @@ class Graphics : public gcn::SDLGraphics const int x2, const int y2, const int width, const int height); - gcn::Font *getFont() const A_WARN_UNUSED + const gcn::Font *getFont() const A_WARN_UNUSED { return mFont; } gcn::ClipRectangle &getTopClip() A_WARN_UNUSED diff --git a/src/gui/killstats.cpp b/src/gui/killstats.cpp index 61d8acfcb..d45e6a4bb 100644 --- a/src/gui/killstats.cpp +++ b/src/gui/killstats.cpp @@ -215,8 +215,8 @@ void KillStats::gainXp(int xp) const int exp = PlayerInfo::getAttribute(PlayerInfo::EXP); mLine1->setCaption(strprintf(_("Level: %d at %f%%"), - player_node->getLevel(), static_cast<double>(exp) / static_cast<double>( - xpNextLevel) * 100.0)); + player_node->getLevel(), static_cast<double>(exp) + / static_cast<double>(xpNextLevel) * 100.0)); mLine2->setCaption(strprintf(_("Exp: %d/%d Left: %d"), exp, xpNextLevel, xpNextLevel - exp)); diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index c9362471f..8394af227 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -349,12 +349,12 @@ void Minimap::draw(gcn::Graphics *graphics) if (player_node->isInParty()) { - Party *const party = player_node->getParty(); + const Party *const party = player_node->getParty(); if (party) { const PartyMember *const m = party->getMember( player_node->getName()); - Party::MemberList *const members = party->getMembers(); + const Party::MemberList *const members = party->getMembers(); if (m && members) { const std::string curMap = m->getMap(); diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 8bc53836f..264cda9d5 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -1217,7 +1217,7 @@ void PopupMenu::handleLink(const std::string &link, if (guild) { if (guild->getServerGuild()) - Net::getGuildHandler()->kick(guild->getMember(mNick)); + Net::getGuildHandler()->kick(guild->getMember(mNick), ""); else if (guildManager) guildManager->kick(mNick); } diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index dde6b30f2..10eb2596e 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -663,7 +663,7 @@ public: if (!socialWindow || !player_node) return; - Map *const map = socialWindow->getMap(); + const Map *const map = socialWindow->getMap(); if (!map || map->empty()) return; diff --git a/src/gui/socialwindow.h b/src/gui/socialwindow.h index 2c959695f..68abef2a4 100644 --- a/src/gui/socialwindow.h +++ b/src/gui/socialwindow.h @@ -103,7 +103,7 @@ public: void prevTab(); - Map* getMap() const A_WARN_UNUSED + const Map* getMap() const A_WARN_UNUSED { return mMap; } void setMap(Map *const map) diff --git a/src/gui/theme.h b/src/gui/theme.h index 223716057..7914c9c26 100644 --- a/src/gui/theme.h +++ b/src/gui/theme.h @@ -76,19 +76,19 @@ class Skin final /** * Returns the background skin. */ - ImageRect &getBorder() const A_WARN_UNUSED + const ImageRect &getBorder() const A_WARN_UNUSED { return *mBorder; } /** * Returns the image used by a close button for this skin. */ - Image *getCloseImage(const bool state) const A_WARN_UNUSED + const Image *getCloseImage(const bool state) const A_WARN_UNUSED { return state ? mCloseImageHighlighted : mCloseImage; } /** * Returns the image used by a sticky button for this skin. */ - Image *getStickyImage(const bool state) const A_WARN_UNUSED + const Image *getStickyImage(const bool state) const A_WARN_UNUSED { return state ? mStickyImageDown : mStickyImageUp; } /** diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index 83c5f2c95..16f5b7db3 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -264,7 +264,7 @@ void Button::updateAlpha() Skin *skin = button[mode]; if (skin) { - ImageRect &rect = skin->getBorder(); + const ImageRect &rect = skin->getBorder(); Image *image = rect.grid[a]; if (image) image->setAlpha(mAlpha); diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp index ac0a226ee..77f81f72b 100644 --- a/src/gui/widgets/checkbox.cpp +++ b/src/gui/widgets/checkbox.cpp @@ -112,7 +112,7 @@ void CheckBox::updateAlpha() mAlpha = alpha; if (mSkin) { - ImageRect &rect = mSkin->getBorder(); + const ImageRect &rect = mSkin->getBorder(); for (int a = 0; a < 6; a ++) { Image *const image = rect.grid[a]; diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp index e40248121..16604d760 100644 --- a/src/gui/widgets/guitable.cpp +++ b/src/gui/widgets/guitable.cpp @@ -121,7 +121,7 @@ GuiTable::~GuiTable() mModel = nullptr; } -TableModel *GuiTable::getModel() const +const TableModel *GuiTable::getModel() const { return mModel; } diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h index 9657de9f8..0b2b4462c 100644 --- a/src/gui/widgets/guitable.h +++ b/src/gui/widgets/guitable.h @@ -66,7 +66,7 @@ public: /** * Retrieves the active table model */ - TableModel *getModel() const A_WARN_UNUSED; + const TableModel *getModel() const A_WARN_UNUSED; /** * Sets the table model diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp index 1a6b9df70..06391217d 100644 --- a/src/gui/widgets/radiobutton.cpp +++ b/src/gui/widgets/radiobutton.cpp @@ -92,7 +92,7 @@ void RadioButton::updateAlpha() mAlpha = alpha; if (mSkin) { - ImageRect &rect = mSkin->getBorder(); + const ImageRect &rect = mSkin->getBorder(); for (int a = 0; a < 4; a ++) { Image *const image = rect.grid[a]; diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp index 35a9a17b4..18e2510ee 100644 --- a/src/gui/widgets/tab.cpp +++ b/src/gui/widgets/tab.cpp @@ -141,7 +141,7 @@ void Tab::updateAlpha() Skin *skin = tabImg[t]; if (skin) { - ImageRect &rect = skin->getBorder(); + const ImageRect &rect = skin->getBorder(); Image *image = rect.grid[a]; if (image) image->setAlpha(mAlpha); @@ -205,7 +205,7 @@ void Tab::draw(gcn::Graphics *graphics) // draw tab if (openGLMode != 2) { - ImageRect &rect = skin->getBorder(); + const ImageRect &rect = skin->getBorder(); if (mRedraw || mode != mMode || static_cast<Graphics*>(graphics)->getRedraw()) { diff --git a/src/guild.h b/src/guild.h index e29e2a4f6..0a4a82397 100644 --- a/src/guild.h +++ b/src/guild.h @@ -41,7 +41,7 @@ class GuildMember final : public Avatar public: A_DELETE_COPY(GuildMember) - Guild *getGuild() const A_WARN_UNUSED + const Guild *getGuild() const A_WARN_UNUSED { return mGuild; } int getPos() const A_WARN_UNUSED diff --git a/src/localplayer.h b/src/localplayer.h index 2213060bf..5aefca302 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -402,7 +402,7 @@ class LocalPlayer final : public Being, void respawn(); - FloorItem *getPickUpTarget() const A_WARN_UNUSED + const FloorItem *getPickUpTarget() const A_WARN_UNUSED { return mPickUpTarget; } void unSetPickUpTarget() @@ -350,7 +350,7 @@ class Map final : public Properties, public ConfigListener const int x, const int y, const bool addNew = true); - std::vector<MapItem*> &getPortals() A_WARN_UNUSED + const std::vector<MapItem*> &getPortals() const A_WARN_UNUSED { return mMapPortals; } /** diff --git a/src/net/charserverhandler.h b/src/net/charserverhandler.h index 44d0684f3..c12a969aa 100644 --- a/src/net/charserverhandler.h +++ b/src/net/charserverhandler.h @@ -76,7 +76,7 @@ class CharServerHandler virtual void requestCharacters() = 0; - virtual void chooseCharacter(Net::Character *character) = 0; + virtual void chooseCharacter(Net::Character *const character) = 0; virtual void newCharacter(const std::string &name, const int slot, const bool gender, const int hairstyle, diff --git a/src/net/ea/gui/guildtab.cpp b/src/net/ea/gui/guildtab.cpp index 909cdb8c2..26f984a9a 100644 --- a/src/net/ea/gui/guildtab.cpp +++ b/src/net/ea/gui/guildtab.cpp @@ -99,7 +99,7 @@ bool GuildTab::handleCommand(const std::string &type, const std::string &args) } else if (type == "kick" && taGuild) { - Net::getGuildHandler()->kick(taGuild->getMember(args)); + Net::getGuildHandler()->kick(taGuild->getMember(args), ""); } else if (type == "notice" && taGuild) { diff --git a/src/net/ea/gui/partytab.cpp b/src/net/ea/gui/partytab.cpp index e8689d7d0..fc59136e1 100644 --- a/src/net/ea/gui/partytab.cpp +++ b/src/net/ea/gui/partytab.cpp @@ -175,6 +175,7 @@ bool PartyTab::handleCommand(const std::string &type, const std::string &args) break; case -1: chatLog(strprintf(BOOLEAN_OPTIONS, "item")); + break; default: break; } @@ -214,6 +215,7 @@ bool PartyTab::handleCommand(const std::string &type, const std::string &args) break; case -1: chatLog(strprintf(BOOLEAN_OPTIONS, "exp")); + break; default: break; } diff --git a/src/net/ea/loginhandler.h b/src/net/ea/loginhandler.h index eb81ceb6f..1efc94a2a 100644 --- a/src/net/ea/loginhandler.h +++ b/src/net/ea/loginhandler.h @@ -60,7 +60,8 @@ class LoginHandler : public Net::LoginHandler virtual void chooseServer(const unsigned int server) const override; - virtual void registerAccount(LoginData *const loginData) const override; + virtual void registerAccount(LoginData *const loginData) + const override; virtual Worlds getWorlds() const override A_WARN_UNUSED; diff --git a/src/net/eathena/adminhandler.cpp b/src/net/eathena/adminhandler.cpp index 662dee9ed..615cffa28 100644 --- a/src/net/eathena/adminhandler.cpp +++ b/src/net/eathena/adminhandler.cpp @@ -62,6 +62,7 @@ void AdminHandler::handleMessage(Net::MessageIn &msg) NotifyManager::notify(NotifyManager::KICK_FAIL); else NotifyManager::notify(NotifyManager::KICK_SUCCEED); + break; default: break; } diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp index 9ec9fe621..ae13a47b7 100644 --- a/src/net/eathena/chathandler.cpp +++ b/src/net/eathena/chathandler.cpp @@ -95,6 +95,7 @@ void ChatHandler::handleMessage(Net::MessageIn &msg) case SMSG_IGNORE_ALL_RESPONSE: processIgnoreAllResponse(msg); + break; default: break; diff --git a/src/net/eathena/gamehandler.cpp b/src/net/eathena/gamehandler.cpp index fbce4d943..00cfcc827 100644 --- a/src/net/eathena/gamehandler.cpp +++ b/src/net/eathena/gamehandler.cpp @@ -84,6 +84,8 @@ void GameHandler::handleMessage(Net::MessageIn &msg) case SMSG_MAP_CHAR_ID: processMapCharId(msg); + break; + default: break; } diff --git a/src/net/eathena/guildhandler.h b/src/net/eathena/guildhandler.h index c25e8ff6f..26c57411a 100644 --- a/src/net/eathena/guildhandler.h +++ b/src/net/eathena/guildhandler.h @@ -55,7 +55,7 @@ class GuildHandler final : public Ea::GuildHandler, public MessageHandler void leave(const int guildId) const override; void kick(const GuildMember *const member, - const std::string &reason = "") const override; + const std::string &reason) const override; void chat(const int guildId, const std::string &text) const override; diff --git a/src/net/guildhandler.h b/src/net/guildhandler.h index 27bd9a217..23b4048cc 100644 --- a/src/net/guildhandler.h +++ b/src/net/guildhandler.h @@ -54,7 +54,7 @@ class GuildHandler virtual void leave(const int guildId) const = 0; virtual void kick(const GuildMember *const member, - const std::string &reason = "") const = 0; + const std::string &reason) const = 0; virtual void chat(const int guildId, const std::string &text) const = 0; diff --git a/src/net/tmwa/adminhandler.cpp b/src/net/tmwa/adminhandler.cpp index 4ff07bd76..667972539 100644 --- a/src/net/tmwa/adminhandler.cpp +++ b/src/net/tmwa/adminhandler.cpp @@ -62,6 +62,8 @@ void AdminHandler::handleMessage(Net::MessageIn &msg) NotifyManager::notify(NotifyManager::KICK_FAIL); else NotifyManager::notify(NotifyManager::KICK_SUCCEED); + break; + default: break; } diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index 655a6d826..09b3bd518 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -108,6 +108,7 @@ void ChatHandler::handleMessage(Net::MessageIn &msg) case SMSG_IGNORE_ALL_RESPONSE: processIgnoreAllResponse(msg); + break; default: break; diff --git a/src/net/tmwa/guildhandler.h b/src/net/tmwa/guildhandler.h index c4c6cf285..581c9bc2f 100644 --- a/src/net/tmwa/guildhandler.h +++ b/src/net/tmwa/guildhandler.h @@ -49,12 +49,13 @@ class GuildHandler final : public Ea::GuildHandler, public MessageHandler void invite(const int guildId, const Being *const being) const override; - void inviteResponse(const int guildId, const bool response) const override; + void inviteResponse(const int guildId, + const bool response) const override; void leave(const int guildId) const override; void kick(const GuildMember *const member, - const std::string &reason = "") const override; + const std::string &reason) const override; void chat(const int guildId, const std::string &text) const override; diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index ec07a1b51..162841693 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -104,6 +104,7 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) case SMSG_ONLINE_LIST: processOnlineList(msg); + break; default: break; diff --git a/src/notifications.h b/src/notifications.h index 981b6ecc6..b87b73670 100644 --- a/src/notifications.h +++ b/src/notifications.h @@ -187,7 +187,8 @@ namespace NotifyManager {"party invite done", N_("%s is now a member of your party."), PARTY_STRING}, {"party invite full", - N_("%s can't join your party because party is full."), PARTY_STRING}, + N_("%s can't join your party because party is full."), + PARTY_STRING}, {"party invite error", N_("QQQ Unknown invite response for %s."), PARTY_STRING}, {"party exp sharing on", diff --git a/src/notifymanager.cpp b/src/notifymanager.cpp index b889c66f3..4e5452e0b 100644 --- a/src/notifymanager.cpp +++ b/src/notifymanager.cpp @@ -87,6 +87,7 @@ namespace NotifyManager { if (player_node) player_node->setSpeech(gettext(info.text)); + break; } case INT: diff --git a/src/party.h b/src/party.h index ffc21b852..aad6adaad 100644 --- a/src/party.h +++ b/src/party.h @@ -151,7 +151,7 @@ public: typedef std::vector<PartyMember*> MemberList; - MemberList *getMembers() A_WARN_UNUSED + const MemberList *getMembers() const A_WARN_UNUSED { return &mMembers; } static Party *getParty(const short id) A_WARN_UNUSED; diff --git a/src/playerrelations.h b/src/playerrelations.h index 219068f6e..c4c5e643a 100644 --- a/src/playerrelations.h +++ b/src/playerrelations.h @@ -192,7 +192,8 @@ class PlayerRelationsManager final * * \return A player ignore strategy, or nullptr */ - PlayerIgnoreStrategy *getPlayerIgnoreStrategy() const A_WARN_UNUSED + const PlayerIgnoreStrategy *getPlayerIgnoreStrategy() const + A_WARN_UNUSED { return mIgnoreStrategy; } /** |