From a83513ef88a9cfca8692db9176b68ddeea71931f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 28 Aug 2014 21:44:08 +0300 Subject: Fix code style. --- src/actions/actions.cpp | 4 ++-- src/actions/chat.cpp | 18 +++++++++--------- src/actions/commands.cpp | 20 +++++++++++--------- src/actions/commands.h | 2 +- src/actions/windows.cpp | 2 +- src/actions/windows.h | 2 +- src/events/inputevent.h | 2 ++ src/gui/dialogsmanager.cpp | 4 ++++ src/gui/models/keylistmodel.h | 2 ++ src/gui/popupmanager.cpp | 6 +++--- src/gui/popupmanager.h | 16 ++++++++-------- src/gui/widgets/tabs/setup_input.cpp | 19 ++++++++++++------- src/gui/windows/chatwindow.cpp | 2 -- src/input/inputaction.h | 4 ++++ src/net/ea/gui/partytab.cpp | 1 - src/utils/chatutils.cpp | 1 - src/utils/chatutils.h | 2 +- 17 files changed, 61 insertions(+), 46 deletions(-) (limited to 'src') diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index 6305be217..cb13bb01e 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -290,7 +290,7 @@ impHandler0(dropItem) return false; } -impHandler0(heal) +impHandler(heal) { if (actorManager) { @@ -461,7 +461,7 @@ impHandler0(untarget) return false; } -impHandler0(attack) +impHandler(attack) { if (!localPlayer || !actorManager) return false; diff --git a/src/actions/chat.cpp b/src/actions/chat.cpp index feab53e93..c10a48fa3 100644 --- a/src/actions/chat.cpp +++ b/src/actions/chat.cpp @@ -40,7 +40,6 @@ #include "utils/booleanoptions.h" #include "utils/gettext.h" -#include "utils/stringutils.h" #include "debug.h" @@ -172,7 +171,7 @@ impHandler0(scrollChatDown) impHandler(msg) { std::string recvnick; - std::string msg; + std::string message; if (event.args.substr(0, 1) == "\"") { @@ -181,7 +180,7 @@ impHandler(msg) { recvnick = event.args.substr(1, pos - 1); if (pos + 2 < event.args.length()) - msg = event.args.substr(pos + 2, event.args.length()); + message = event.args.substr(pos + 2, event.args.length()); } } else @@ -191,18 +190,18 @@ impHandler(msg) { recvnick = event.args.substr(0, pos); if (pos + 1 < event.args.length()) - msg = event.args.substr(pos + 1, event.args.length()); + message = event.args.substr(pos + 1, event.args.length()); } else { recvnick = std::string(event.args); - msg.clear(); + message.clear(); } } - trim(msg); + trim(message); - if (msg.length() > 0) + if (message.length() > 0) { std::string playerName = localPlayer->getName(); std::string tempNick = recvnick; @@ -213,12 +212,13 @@ impHandler(msg) if (tempNick.compare(playerName) == 0 || event.args.empty()) return true; - chatWindow->addWhisper(recvnick, msg, ChatMsgType::BY_PLAYER); + chatWindow->addWhisper(recvnick, message, ChatMsgType::BY_PLAYER); } else { // TRANSLATORS: whisper send - event.tab->chatLog(_("Cannot send empty whispers!"), ChatMsgType::BY_SERVER); + event.tab->chatLog(_("Cannot send empty whispers!"), + ChatMsgType::BY_SERVER); } return true; } diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index daee32717..5a7e16334 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -46,7 +46,6 @@ #include "utils/chatutils.h" #include "utils/gettext.h" #include "utils/process.h" -#include "utils/stringutils.h" #include "debug.h" @@ -64,7 +63,8 @@ static std::string getNick(const InputEvent &event) if (!whisper || whisper->getNick().empty()) { // TRANSLATORS: change relation - event.tab->chatLog(_("Please specify a name."), ChatMsgType::BY_SERVER); + event.tab->chatLog(_("Please specify a name."), + ChatMsgType::BY_SERVER); return std::string(); } args = whisper->getNick(); @@ -151,7 +151,8 @@ impHandler(chatUnignore) if (event.tab) { // TRANSLATORS: unignore command - event.tab->chatLog(_("Player wasn't ignored!"), ChatMsgType::BY_SERVER); + event.tab->chatLog(_("Player wasn't ignored!"), + ChatMsgType::BY_SERVER); } return true; } @@ -176,7 +177,8 @@ impHandler(chatErase) if (event.tab) { // TRANSLATORS: erase command - event.tab->chatLog(_("Player already erased!"), ChatMsgType::BY_SERVER); + event.tab->chatLog(_("Player already erased!"), + ChatMsgType::BY_SERVER); } return true; } @@ -504,11 +506,11 @@ impHandler(url) { if (event.tab) { - std::string url = event.args; - if (!strStartWith(url, "http") && !strStartWith(url, "?")) - url = "http://" + url; + std::string url1 = event.args; + if (!strStartWith(url1, "http") && !strStartWith(url1, "?")) + url1 = "http://" + url1; std::string str(strprintf("[@@%s |%s@@]", - url.c_str(), event.args.c_str())); + url1.c_str(), event.args.c_str())); outStringNormal(event.tab, str, str); return true; } @@ -652,7 +654,7 @@ impHandler(hack) return true; } -impHandler0(debugSpawn) +impHandler(debugSpawn) { int cnt = atoi(event.args.c_str()); if (cnt < 1) diff --git a/src/actions/commands.h b/src/actions/commands.h index 1d6e5bd9d..46932681c 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -75,4 +75,4 @@ namespace Actions #undef decHandler -#endif // ACTIONS_CHAT_H +#endif // ACTIONS_COMMANDS_H diff --git a/src/actions/windows.cpp b/src/actions/windows.cpp index 4fcde2a52..edbadd5d0 100644 --- a/src/actions/windows.cpp +++ b/src/actions/windows.cpp @@ -97,7 +97,7 @@ static bool showHelpPage(const std::string &page, const bool showHide) return false; } -impHandler0(helpWindowShow) +impHandler(helpWindowShow) { if (!chatWindow || !chatWindow->isInputFocused()) return showHelpPage("index", true); diff --git a/src/actions/windows.h b/src/actions/windows.h index 9b0184feb..1c8293334 100644 --- a/src/actions/windows.h +++ b/src/actions/windows.h @@ -55,4 +55,4 @@ namespace Actions #undef decHandler -#endif // ACTIONS_ACTIONS_H +#endif // ACTIONS_WINDOWS_H diff --git a/src/events/inputevent.h b/src/events/inputevent.h index 53f629a1d..3d3c48552 100644 --- a/src/events/inputevent.h +++ b/src/events/inputevent.h @@ -60,6 +60,8 @@ struct InputEvent final mask(mask0) { } + A_DELETE_COPY(InputEvent) + const std::string args; ChatTab *const tab; const int action; diff --git a/src/gui/dialogsmanager.cpp b/src/gui/dialogsmanager.cpp index 83fc286ca..dd5cfee6e 100644 --- a/src/gui/dialogsmanager.cpp +++ b/src/gui/dialogsmanager.cpp @@ -42,6 +42,10 @@ #include "debug.h" +#ifdef WIN32 +#undef ERROR +#endif + extern OkDialog *deathNotice; void DialogsManager::closeDialogs() diff --git a/src/gui/models/keylistmodel.h b/src/gui/models/keylistmodel.h index 007722087..399dd7482 100644 --- a/src/gui/models/keylistmodel.h +++ b/src/gui/models/keylistmodel.h @@ -30,6 +30,8 @@ #include "localconsts.h" +extern SetupActionData *const setupActionData[]; + /** * The list model for key function list. * diff --git a/src/gui/popupmanager.cpp b/src/gui/popupmanager.cpp index 9b254746e..f27b94c86 100644 --- a/src/gui/popupmanager.cpp +++ b/src/gui/popupmanager.cpp @@ -64,7 +64,7 @@ void PopupManager::hidePopupMenu() popupMenu->setVisible(false); } -bool PopupManager::isPopupMenuVisible() const +bool PopupManager::isPopupMenuVisible() { return popupMenu ? popupMenu->isPopupVisible() : false; } @@ -75,12 +75,12 @@ void PopupManager::clearPopup() popupMenu->clear(); } -bool PopupManager::isTextPopupVisible() const +bool PopupManager::isTextPopupVisible() { return textPopup ? textPopup->isPopupVisible() : false; } -bool PopupManager::isBeingPopupVisible() const +bool PopupManager::isBeingPopupVisible() { return beingPopup ? beingPopup->isPopupVisible() : false; } diff --git a/src/gui/popupmanager.h b/src/gui/popupmanager.h index c34934798..49b0c7fd6 100644 --- a/src/gui/popupmanager.h +++ b/src/gui/popupmanager.h @@ -40,28 +40,28 @@ class PopupManager final */ ~PopupManager(); - bool isBeingPopupVisible() const; + static bool isBeingPopupVisible() A_WARN_UNUSED; - bool isTextPopupVisible() const; + static bool isTextPopupVisible() A_WARN_UNUSED; /** * Closes the popup menu. Needed for when the player dies or switching * maps. */ - void closePopupMenu(); + static void closePopupMenu(); /** * Hides the BeingPopup. */ - void hideBeingPopup(); + static void hideBeingPopup(); - void hideTextPopup(); + static void hideTextPopup(); - bool isPopupMenuVisible() const A_WARN_UNUSED; + static bool isPopupMenuVisible() A_WARN_UNUSED; - void clearPopup(); + static void clearPopup(); - void hidePopupMenu(); + static void hidePopupMenu(); }; extern PopupManager *popupManager; diff --git a/src/gui/widgets/tabs/setup_input.cpp b/src/gui/widgets/tabs/setup_input.cpp index 3c467f046..b9d9949d5 100644 --- a/src/gui/widgets/tabs/setup_input.cpp +++ b/src/gui/widgets/tabs/setup_input.cpp @@ -370,16 +370,21 @@ void Setup_Input::fixTranslations() { fixTranslation(setupActionDataShortcuts, static_cast(InputAction::SHORTCUT_1), - static_cast(InputAction::SHORTCUT_20), "Item Shortcut %d"); + static_cast(InputAction::SHORTCUT_20), + "Item Shortcut %d"); - fixTranslation(setupActionDataEmotes, static_cast(InputAction::EMOTE_1), - static_cast(InputAction::EMOTE_48), "Emote Shortcut %d"); + fixTranslation(setupActionDataEmotes, + static_cast(InputAction::EMOTE_1), + static_cast(InputAction::EMOTE_48), + "Emote Shortcut %d"); - fixTranslation(setupActionDataOutfits, static_cast(InputAction::OUTFIT_1), - static_cast(InputAction::OUTFIT_48), "Outfit Shortcut %d"); + fixTranslation(setupActionDataOutfits, + static_cast(InputAction::OUTFIT_1), + static_cast(InputAction::OUTFIT_48), + "Outfit Shortcut %d"); - fixTranslation(setupActionDataMove, static_cast( - InputAction::MOVE_TO_POINT_1), + fixTranslation(setupActionDataMove, + static_cast(InputAction::MOVE_TO_POINT_1), static_cast(InputAction::MOVE_TO_POINT_48), "Move to point Shortcut %d"); } diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index e5be2fc65..0efa9c08d 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -35,8 +35,6 @@ #include "being/playerinfo.h" #include "being/playerrelations.h" -#include "events/keyevent.h" - #include "input/inputmanager.h" #include "gui/chatconsts.h" diff --git a/src/input/inputaction.h b/src/input/inputaction.h index 8001a33da..99ab3a914 100644 --- a/src/input/inputaction.h +++ b/src/input/inputaction.h @@ -23,6 +23,10 @@ #ifndef INPUT_INPUTACTION_H #define INPUT_INPUTACTION_H +#ifdef WIN32 +#undef ERROR +#undef IGNORE +#endif namespace InputAction { /** diff --git a/src/net/ea/gui/partytab.cpp b/src/net/ea/gui/partytab.cpp index 5e6e1d3eb..7a76f7ba9 100644 --- a/src/net/ea/gui/partytab.cpp +++ b/src/net/ea/gui/partytab.cpp @@ -36,7 +36,6 @@ #include "gui/windows/chatwindow.h" #include "utils/booleanoptions.h" -#include "utils/gettext.h" #include "debug.h" diff --git a/src/utils/chatutils.cpp b/src/utils/chatutils.cpp index 41fcaa77b..ea37b7fd2 100644 --- a/src/utils/chatutils.cpp +++ b/src/utils/chatutils.cpp @@ -30,7 +30,6 @@ #include "gui/chatconsts.h" #include "gui/widgets/tabs/whispertab.h" -#include "gui/widgets/tabs/chattabtype.h" #include "net/chathandler.h" #include "net/guildhandler.h" diff --git a/src/utils/chatutils.h b/src/utils/chatutils.h index 79f6f2093..7c7c0102f 100644 --- a/src/utils/chatutils.h +++ b/src/utils/chatutils.h @@ -31,4 +31,4 @@ void outStringNormal(ChatTab *const tab, void replaceVars(std::string &str); -#endif // ACTIONS_ACTIONS_H +#endif // UTILS_CHATUTILS_H -- cgit v1.2.3-60-g2f50