From c757bf80478dd5e4e40a6c24b436954ab498a855 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 10 Oct 2014 15:31:36 +0300 Subject: Fix code style. --- src/actions/commands.cpp | 2 +- src/actormanager.h | 6 +++--- src/being/being.h | 2 +- src/gui/gui.cpp | 2 -- src/gui/widgets/button.cpp | 2 -- src/gui/widgets/dropdown.cpp | 2 -- src/gui/widgets/equipmentpage.h | 3 ++- src/gui/widgets/inttextfield.cpp | 2 -- src/gui/widgets/slider.cpp | 2 -- src/gui/widgets/tabbedarea.cpp | 2 -- src/gui/widgets/tabstrip.cpp | 2 +- src/gui/windows/buyselldialog.cpp | 2 +- src/gui/windows/charcreatedialog.cpp | 2 -- src/gui/windows/charselectdialog.cpp | 12 ++++-------- src/gui/windows/chatwindow.cpp | 1 - src/gui/windows/editserverdialog.cpp | 2 -- src/gui/windows/equipmentwindow.cpp | 2 +- src/gui/windows/equipmentwindow.h | 3 +-- src/gui/windows/inventorywindow.cpp | 2 -- src/gui/windows/logindialog.cpp | 2 -- src/gui/windows/ministatuswindow.cpp | 3 +-- src/gui/windows/quitdialog.cpp | 2 -- src/gui/windows/registerdialog.cpp | 2 -- src/gui/windows/statuswindow.cpp | 3 +-- src/gui/windows/updaterwindow.cpp | 2 -- src/guild.h | 2 -- src/listeners/charrenamelistener.cpp | 3 ++- src/net/ea/beinghandler.cpp | 6 +----- src/net/ea/eaprotocol.h | 2 +- src/net/ea/guildhandler.cpp | 3 +-- src/net/ea/tradehandler.cpp | 5 ----- src/net/eathena/beinghandler.cpp | 2 +- src/net/eathena/charserverhandler.cpp | 4 ++-- src/net/eathena/guildhandler.cpp | 5 ----- src/net/eathena/tradehandler.cpp | 1 - src/net/messagein.cpp | 1 - src/net/packetlimiter.cpp | 1 - src/net/tmwa/guildhandler.cpp | 5 ----- src/net/tmwa/playerhandler.cpp | 2 -- src/resources/skillowner.h | 3 +-- 40 files changed, 26 insertions(+), 86 deletions(-) diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index 5a48db7a9..1f7f77157 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -659,7 +659,7 @@ impHandler(debugSpawn) for (int x = -half; x < cnt - half; x ++) { for (int y = -half; y < cnt - half; y ++) - actorManager->cloneBeing(localPlayer, x, y, cnt); + ActorManager::cloneBeing(localPlayer, x, y, cnt); } return true; } diff --git a/src/actormanager.h b/src/actormanager.h index 687ca4042..1688ce3d2 100644 --- a/src/actormanager.h +++ b/src/actormanager.h @@ -65,9 +65,9 @@ class ActorManager final: public ConfigListener const ActorType::Type type, const uint16_t subtype) A_WARN_UNUSED; - Being *cloneBeing(const Being *const srcBeing, - const int dx, const int dy, - const int id); + static Being *cloneBeing(const Being *const srcBeing, + const int dx, const int dy, + const int id); /** * Create a FloorItem and add it to the list of ActorSprites. diff --git a/src/being/being.h b/src/being/being.h index b5becbf7a..49337b5da 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -104,7 +104,7 @@ class Being notfinal : public ActorSprite, CRITICAL = 10, FLEE = 11, TOUCH_SKILL = 12, -//? SKILL = 0xff, +// SKILL = 0xff, MISS = 0xffff // pseudo value for miss attacks }; diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 0f8561643..53d8fe638 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -80,8 +80,6 @@ #include "settings.h" #include "touchmanager.h" -#include "events/keyevent.h" - #include "listeners/focuslistener.h" #include "listeners/guiconfiglistener.h" #include "listeners/keylistener.h" diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index de2bd0c8b..581dd3a9e 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -68,8 +68,6 @@ #include "graphicsvertexes.h" #include "settings.h" -#include "events/keyevent.h" - #include "input/inputaction.h" #include "resources/image.h" diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 7957b0587..db951692e 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -24,8 +24,6 @@ #include "settings.h" -#include "events/keyevent.h" - #include "input/inputaction.h" #include "gui/gui.h" diff --git a/src/gui/widgets/equipmentpage.h b/src/gui/widgets/equipmentpage.h index bbafca15d..a62159cd1 100644 --- a/src/gui/widgets/equipmentpage.h +++ b/src/gui/widgets/equipmentpage.h @@ -25,9 +25,10 @@ #include "localconsts.h" -class EquipmentBox; class PlayerBox; +struct EquipmentBox; + struct EquipmentPage final { EquipmentPage() : diff --git a/src/gui/widgets/inttextfield.cpp b/src/gui/widgets/inttextfield.cpp index c2d84c66a..b268f3ce6 100644 --- a/src/gui/widgets/inttextfield.cpp +++ b/src/gui/widgets/inttextfield.cpp @@ -26,8 +26,6 @@ #include "gui/sdlinput.h" #endif -#include "events/keyevent.h" - #include "input/inputaction.h" #include "utils/stringutils.h" diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index e36c24b2c..4a7bf6ad1 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -68,8 +68,6 @@ #include "graphicsvertexes.h" #include "settings.h" -#include "events/keyevent.h" - #include "input/inputaction.h" #include "gui/gui.h" diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index 36e3aa093..cbe304970 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -65,8 +65,6 @@ #include "gui/widgets/tabbedarea.h" -#include "events/keyevent.h" - #include "input/inputaction.h" #include "gui/gui.h" diff --git a/src/gui/widgets/tabstrip.cpp b/src/gui/widgets/tabstrip.cpp index a5b5fd7e6..7c6627fbf 100644 --- a/src/gui/widgets/tabstrip.cpp +++ b/src/gui/widgets/tabstrip.cpp @@ -49,7 +49,7 @@ Widget *TabStrip::createWidget(const std::string &text) const widget->adjustSize(); if (!mCount) widget->setPressed(true); - widget->setTag(mWidgets.size()); + widget->setTag(static_cast(mWidgets.size())); return widget; } diff --git a/src/gui/windows/buyselldialog.cpp b/src/gui/windows/buyselldialog.cpp index 2de5841bc..eacd952bd 100644 --- a/src/gui/windows/buyselldialog.cpp +++ b/src/gui/windows/buyselldialog.cpp @@ -65,7 +65,7 @@ void BuySellDialog::init() if (setupWindow) setupWindow->registerWindowForReset(this); - static const char *buttonNames[] = + static const char *const buttonNames[] = { // TRANSLATORS: shop window button N_("Buy"), diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp index b34f8f50a..05dfb2171 100644 --- a/src/gui/windows/charcreatedialog.cpp +++ b/src/gui/windows/charcreatedialog.cpp @@ -24,8 +24,6 @@ #include "main.h" -#include "events/keyevent.h" - #include "input/inputaction.h" #include "gui/dialogtype.h" diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp index 5ec3ab2b7..fef43b605 100644 --- a/src/gui/windows/charselectdialog.cpp +++ b/src/gui/windows/charselectdialog.cpp @@ -26,8 +26,6 @@ #include "configuration.h" #include "units.h" -#include "events/keyevent.h" - #include "input/inputaction.h" #include "being/attributes.h" @@ -234,7 +232,7 @@ void CharSelectDialog::action(const ActionEvent &event) else if (eventId == "rename" && mCharacterEntries[selected]->getCharacter()) { - LocalPlayer *const player = mCharacterEntries[ + const LocalPlayer *const player = mCharacterEntries[ selected]->getCharacter()->dummy; EditDialog *const dialog = new EditDialog( _("Please enter new name"), player->getName(), "OK"); @@ -525,8 +523,7 @@ void CharSelectDialog::setLocked(const bool locked) mUnregisterButton->setEnabled(!locked); if (mChangeEmailButton) mChangeEmailButton->setEnabled(!locked); - if (mPlayButton) - mPlayButton->setEnabled(!locked); + mPlayButton->setEnabled(!locked); if (mDeleteButton) mDeleteButton->setEnabled(!locked); @@ -575,8 +572,7 @@ void CharSelectDialog::close() void CharSelectDialog::widgetResized(const Event &event) { Window::widgetResized(event); - if (mCharacterView) - mCharacterView->resize(); + mCharacterView->resize(); } void CharSelectDialog::updateState() @@ -594,7 +590,7 @@ void CharSelectDialog::updateState() // TRANSLATORS: char select dialog. button. mPlayButton->setCaption(_("Play")); - LocalPlayer *const player = mCharacterEntries[ + const LocalPlayer *const player = mCharacterEntries[ idx]->getCharacter()->dummy; if (player && mRenameButton) mRenameButton->setEnabled(player->getRename() ? true : false); diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 559c87704..da64f195d 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -67,7 +67,6 @@ #include "render/opengldebug.h" #include "net/chathandler.h" -#include "net/playerhandler.h" #include "utils/copynpaste.h" #include "utils/delete2.h" diff --git a/src/gui/windows/editserverdialog.cpp b/src/gui/windows/editserverdialog.cpp index 5e5997985..6d06bba08 100644 --- a/src/gui/windows/editserverdialog.cpp +++ b/src/gui/windows/editserverdialog.cpp @@ -21,8 +21,6 @@ #include "gui/windows/editserverdialog.h" -#include "events/keyevent.h" - #include "input/inputaction.h" #include "gui/dialogtype.h" diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp index 76863ffbd..08c6aea51 100644 --- a/src/gui/windows/equipmentwindow.cpp +++ b/src/gui/windows/equipmentwindow.cpp @@ -773,5 +773,5 @@ int EquipmentWindow::addPage(const std::string &name) boxes.push_back(nullptr); mTabs->addButton(name); - return mPages.size() - 1; + return static_cast(mPages.size()) - 1; } diff --git a/src/gui/windows/equipmentwindow.h b/src/gui/windows/equipmentwindow.h index 628b2fdbe..8c77b6d28 100644 --- a/src/gui/windows/equipmentwindow.h +++ b/src/gui/windows/equipmentwindow.h @@ -26,7 +26,6 @@ #include "equipment.h" #include "localconsts.h" -#include "gui/widgets/equipmentpage.h" #include "gui/widgets/window.h" #include "utils/xml.h" @@ -43,7 +42,7 @@ class Item; class PlayerBox; class TabStrip; -struct EquipmentBox; +struct EquipmentPage; /** * Equipment dialog. diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index 390b0400b..c1fea4158 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -29,8 +29,6 @@ #include "being/attributes.h" #include "being/playerinfo.h" -#include "events/keyevent.h" - #include "input/inputmanager.h" #include "gui/gui.h" diff --git a/src/gui/windows/logindialog.cpp b/src/gui/windows/logindialog.cpp index 8f6256616..41cf22f17 100644 --- a/src/gui/windows/logindialog.cpp +++ b/src/gui/windows/logindialog.cpp @@ -25,8 +25,6 @@ #include "client.h" #include "configuration.h" -#include "events/keyevent.h" - #include "input/inputaction.h" #include "listeners/openurllistener.h" diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp index 40d4c1124..adcd1c9d2 100644 --- a/src/gui/windows/ministatuswindow.cpp +++ b/src/gui/windows/ministatuswindow.cpp @@ -121,8 +121,7 @@ MiniStatusWindow::MiniStatusWindow() : if (gameHandler->canUseMagicBar() && statusWindow) statusWindow->updateMPBar(mMpBar); - const int job = Attributes::JOB - && serverConfig.getValueBool("showJob", true); + const bool job = serverConfig.getValueBool("showJob", true); StatusWindow::updateXPBar(mXpBar); diff --git a/src/gui/windows/quitdialog.cpp b/src/gui/windows/quitdialog.cpp index c5cd311a3..67020a47d 100644 --- a/src/gui/windows/quitdialog.cpp +++ b/src/gui/windows/quitdialog.cpp @@ -27,8 +27,6 @@ #include "soundconsts.h" #include "soundmanager.h" -#include "events/keyevent.h" - #include "input/inputaction.h" #include "gui/dialogsmanager.h" diff --git a/src/gui/windows/registerdialog.cpp b/src/gui/windows/registerdialog.cpp index 3b4ee0539..d09725e95 100644 --- a/src/gui/windows/registerdialog.cpp +++ b/src/gui/windows/registerdialog.cpp @@ -24,8 +24,6 @@ #include "client.h" -#include "events/keyevent.h" - #include "input/inputaction.h" #include "listeners/wrongdatanoticelistener.h" diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp index 227528b20..9d979f27f 100644 --- a/src/gui/windows/statuswindow.cpp +++ b/src/gui/windows/statuswindow.cpp @@ -128,8 +128,7 @@ StatusWindow::StatusWindow() : getThemeColor(Theme::XP_BAR_OUTLINE)); const bool magicBar = gameHandler->canUseMagicBar(); - const int job = Attributes::JOB - && serverConfig.getValueBool("showJob", true); + const bool job = serverConfig.getValueBool("showJob", true); if (magicBar) { diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index 5dc0a7708..a12219c7a 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -26,8 +26,6 @@ #include "configuration.h" #include "settings.h" -#include "events/keyevent.h" - #include "input/inputaction.h" #include "gui/widgets/browserbox.h" diff --git a/src/guild.h b/src/guild.h index 50870288d..53b925ad1 100644 --- a/src/guild.h +++ b/src/guild.h @@ -25,8 +25,6 @@ #include "avatar.h" -#include "guildpositionflags.h" - #include "gui/models/avatarlistmodel.h" #include "utils/dtor.h" diff --git a/src/listeners/charrenamelistener.cpp b/src/listeners/charrenamelistener.cpp index e39226517..87c1caa02 100644 --- a/src/listeners/charrenamelistener.cpp +++ b/src/listeners/charrenamelistener.cpp @@ -20,9 +20,10 @@ #include "listeners/charrenamelistener.h" -#include "gui/windows/charselectdialog.h" #include "gui/windows/editdialog.h" +#include "net/charserverhandler.h" + #include "debug.h" CharRenameListener charRenameListener; diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index f2aed075d..9f3320dd0 100644 --- a/src/net/ea/beinghandler.cpp +++ b/src/net/ea/beinghandler.cpp @@ -24,15 +24,12 @@ #include "actormanager.h" #include "configuration.h" -#include "effectmanager.h" #include "game.h" #include "party.h" #include "being/localplayer.h" #include "being/playerrelations.h" -#include "particle/particle.h" - #include "gui/viewport.h" #include "gui/windows/botcheckerwindow.h" @@ -390,8 +387,7 @@ void BeingHandler::processPlayerStop(Net::MessageIn &msg) const BLOCK_END("BeingHandler::processPlayerStop") } -void BeingHandler::processPlayerMoveToAttack(Net::MessageIn &msg A_UNUSED) - const +void BeingHandler::processPlayerMoveToAttack(Net::MessageIn &msg) const { BLOCK_START("BeingHandler::processPlayerStop") msg.readInt32("target id"); diff --git a/src/net/ea/eaprotocol.h b/src/net/ea/eaprotocol.h index 00cf0f067..c2c5c1970 100644 --- a/src/net/ea/eaprotocol.h +++ b/src/net/ea/eaprotocol.h @@ -71,7 +71,7 @@ namespace Ea ATTACK_DELAY = 53, JOB = 55 }; -} // namespace Net +} // namespace Ea enum { diff --git a/src/net/ea/guildhandler.cpp b/src/net/ea/guildhandler.cpp index 234ad4933..ebbb93eaf 100644 --- a/src/net/ea/guildhandler.cpp +++ b/src/net/ea/guildhandler.cpp @@ -22,13 +22,11 @@ #include "net/ea/guildhandler.h" #include "actormanager.h" -#include "configuration.h" #include "notifymanager.h" #include "being/localplayer.h" #include "being/playerinfo.h" -#include "gui/windows/chatwindow.h" #include "gui/windows/skilldialog.h" #include "gui/windows/socialwindow.h" @@ -38,6 +36,7 @@ #include "utils/delete2.h" #include "utils/gettext.h" +#include "utils/stringutils.h" #include "resources/notifytypes.h" diff --git a/src/net/ea/tradehandler.cpp b/src/net/ea/tradehandler.cpp index 16e0ca0ad..41e8be6d7 100644 --- a/src/net/ea/tradehandler.cpp +++ b/src/net/ea/tradehandler.cpp @@ -22,9 +22,6 @@ #include "net/ea/tradehandler.h" -#include "inventory.h" -#include "item.h" -#include "logger.h" #include "notifymanager.h" #include "being/playerinfo.h" @@ -35,8 +32,6 @@ #include "net/messagein.h" -#include "net/ea/eaprotocol.h" - #include "utils/gettext.h" #include "resources/notifytypes.h" diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp index 7b3c3fcaf..d0c3f1640 100644 --- a/src/net/eathena/beinghandler.cpp +++ b/src/net/eathena/beinghandler.cpp @@ -1947,7 +1947,7 @@ void BeingHandler::processBeingFakeName(Net::MessageIn &msg) const msg.readUInt8("object type")); const int id = msg.readInt32("npc id"); msg.skip(8, "unused"); - const int job = msg.readInt16("class?"); // 111 + const uint16_t job = msg.readInt16("class?"); // 111 msg.skip(30, "unused"); uint16_t x, y; uint8_t dir; diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp index 5308fdaea..5db0a0d79 100644 --- a/src/net/eathena/charserverhandler.cpp +++ b/src/net/eathena/charserverhandler.cpp @@ -569,8 +569,8 @@ void CharServerHandler::processCharRename(Net::MessageIn &msg) void CharServerHandler::changeSlot(const int oldSlot, const int newSlot) { createOutPacket(CMSG_CHAR_CHANGE_SLOT); - outMsg.writeInt16(oldSlot, "old slot"); - outMsg.writeInt16(newSlot, "new slot"); + outMsg.writeInt16(static_cast(oldSlot), "old slot"); + outMsg.writeInt16(static_cast(newSlot), "new slot"); outMsg.writeInt16(0, "unused"); } diff --git a/src/net/eathena/guildhandler.cpp b/src/net/eathena/guildhandler.cpp index 5e7ed61a7..a1ea449c5 100644 --- a/src/net/eathena/guildhandler.cpp +++ b/src/net/eathena/guildhandler.cpp @@ -23,7 +23,6 @@ #include "actormanager.h" #include "configuration.h" -#include "notifymanager.h" #include "being/localplayer.h" #include "being/playerinfo.h" @@ -36,10 +35,6 @@ #include "net/eathena/messageout.h" #include "net/eathena/protocol.h" -#include "resources/notifytypes.h" - -#include "utils/delete2.h" - #include "debug.h" extern Net::GuildHandler *guildHandler; diff --git a/src/net/eathena/tradehandler.cpp b/src/net/eathena/tradehandler.cpp index 05fd893ca..ef38a4e67 100644 --- a/src/net/eathena/tradehandler.cpp +++ b/src/net/eathena/tradehandler.cpp @@ -22,7 +22,6 @@ #include "net/eathena/tradehandler.h" -#include "inventory.h" #include "item.h" #include "notifymanager.h" diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp index fbe5359e8..dee3c2c64 100644 --- a/src/net/messagein.cpp +++ b/src/net/messagein.cpp @@ -22,7 +22,6 @@ #include "net/messagein.h" -#include "net/net.h" #include "net/packetcounters.h" #include "utils/stringutils.h" diff --git a/src/net/packetlimiter.cpp b/src/net/packetlimiter.cpp index f14daff77..bfa7b8caa 100644 --- a/src/net/packetlimiter.cpp +++ b/src/net/packetlimiter.cpp @@ -23,7 +23,6 @@ #include "configuration.h" #include "settings.h" -//#include "utils/stringutils.h" #include "utils/timer.h" #include diff --git a/src/net/tmwa/guildhandler.cpp b/src/net/tmwa/guildhandler.cpp index 0c1757f86..a22cd69b0 100644 --- a/src/net/tmwa/guildhandler.cpp +++ b/src/net/tmwa/guildhandler.cpp @@ -23,7 +23,6 @@ #include "actormanager.h" #include "configuration.h" -#include "notifymanager.h" #include "being/localplayer.h" #include "being/playerinfo.h" @@ -38,10 +37,6 @@ #include "net/tmwa/messageout.h" #include "net/tmwa/protocol.h" -#include "resources/notifytypes.h" - -#include "utils/delete2.h" - #include "debug.h" extern Net::GuildHandler *guildHandler; diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index 5d648e538..8d332016e 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -25,7 +25,6 @@ #include "configuration.h" #include "game.h" #include "soundmanager.h" -#include "units.h" #include "being/attributes.h" #include "being/beingflag.h" @@ -37,7 +36,6 @@ #include "net/tmwa/messageout.h" #include "net/tmwa/protocol.h" -#include "gui/windows/skilldialog.h" #include "gui/windows/whoisonline.h" #include "gui/onlineplayer.h" diff --git a/src/resources/skillowner.h b/src/resources/skillowner.h index 55473ae40..837c9cc91 100644 --- a/src/resources/skillowner.h +++ b/src/resources/skillowner.h @@ -30,7 +30,6 @@ namespace SkillOwner Homunculus = 2, Guild = 3 }; - -} +} // namespace SkillOwner #endif // RESOURCES_SKILLOWNER_H -- cgit v1.2.3-70-g09d2