From 6fcbad4dc14b65acde858781cb0b0be1e9df9436 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 29 Jul 2012 22:00:35 +0300 Subject: Fix code style. --- src/game.cpp | 2 +- src/gui/questswindow.cpp | 6 ++--- src/gui/questswindow.h | 2 +- src/gui/sdlinput.cpp | 2 +- src/gui/sdlinput.h | 2 +- src/gui/widgets/itemlinkhandler.cpp | 7 +++++- src/localconsts.h | 5 +++++ src/net/eathena/protocol.h | 45 ++++++++++++++++++++----------------- src/net/serverinfo.h | 2 ++ src/net/tmwa/protocol.h | 45 ++++++++++++++++++++----------------- 10 files changed, 68 insertions(+), 50 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index 3081cf089..58a559ec7 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -90,7 +90,7 @@ #include "utils/gettext.h" #include "utils/mkdir.h" -#include "utils/translation/translationmanager.h" +//#include "utils/translation/translationmanager.h" #include #include diff --git a/src/gui/questswindow.cpp b/src/gui/questswindow.cpp index e9eb37600..a33de32b6 100644 --- a/src/gui/questswindow.cpp +++ b/src/gui/questswindow.cpp @@ -133,8 +133,8 @@ QuestsWindow::~QuestsWindow() delete mQuestsModel; mQuestsModel = nullptr; - for (std::map>::iterator it = mQuests.begin(), - it_end = mQuests.end(); it != it_end; ++ it) + for (std::map >::iterator it + = mQuests.begin(), it_end = mQuests.end(); it != it_end; ++ it) { std::vector &quests = (*it).second; for (std::vector::iterator it2 = quests.begin(), @@ -195,7 +195,7 @@ void QuestsWindow::loadQuest(int var, XmlNodePtr node) } quest->incomplete = splitToIntSet(incompleteStr, ','); quest->complete = splitToIntSet(completeStr, ','); - if (quest->incomplete.size() + quest->complete.size() == 0) + if (quest->incomplete.empty() && quest->complete.empty()) { logger->log("complete flags incorrect"); delete quest; diff --git a/src/gui/questswindow.h b/src/gui/questswindow.h index 8454b80f5..4694acb8d 100644 --- a/src/gui/questswindow.h +++ b/src/gui/questswindow.h @@ -74,7 +74,7 @@ class QuestsWindow : public Window, public gcn::ActionListener ScrollArea *mTextScrollArea; Button *mCloseButton; std::map mVars; - std::map> mQuests; + std::map > mQuests; std::vector mQuestLinks; Image *mCompleteIcon; Image *mIncompleteIcon; diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index 55a4e0e6c..283d1b33e 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -284,7 +284,7 @@ int SDLInput::convertKeyCharacter(SDL_Event event) value = Key::ESCAPE; break; case SDLK_DELETE: - value = Key::DELETE; + value = Key::DELETE_; break; case SDLK_INSERT: value = Key::INSERT; diff --git a/src/gui/sdlinput.h b/src/gui/sdlinput.h index c3c0628ff..b6b41fe5c 100644 --- a/src/gui/sdlinput.h +++ b/src/gui/sdlinput.h @@ -91,7 +91,7 @@ namespace Key INSERT, HOME, PAGE_UP, - DELETE, + DELETE_, END, PAGE_DOWN, ESCAPE, diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp index c09aea04c..45cb25463 100644 --- a/src/gui/widgets/itemlinkhandler.cpp +++ b/src/gui/widgets/itemlinkhandler.cpp @@ -67,9 +67,14 @@ void ItemLinkHandler::handleLink(const std::string &link, mItemPopup->setItem(itemInfo, 1, true); if (mItemPopup->isVisible()) + { mItemPopup->setVisible(false); + } else if (viewport) - mItemPopup->position(viewport->getMouseX(), viewport->getMouseY()); + { + mItemPopup->position(viewport->getMouseX(), + viewport->getMouseY()); + } } } else diff --git a/src/localconsts.h b/src/localconsts.h index b01718d92..61d1e0531 100644 --- a/src/localconsts.h +++ b/src/localconsts.h @@ -28,10 +28,15 @@ #ifdef __GNUC__ #define A_UNUSED __attribute__ ((unused)) +# ifdef __clang__ +# define gnu_printf printf +# endif #else #define A_UNUSED +#define gnu_printf printf #endif + //#define DEBUG_CONFIG 1 //#define DEBUG_BIND_TEXTURE 1 //#define DISABLE_RESOURCE_CACHING 1 diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index 3f98fed26..e20ad0dbb 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -23,28 +23,31 @@ #ifndef EATHENA_PROTOCOL_H #define EATHENA_PROTOCOL_H -enum +namespace EAthena { - JOB = 0xa, - - STR = 0xd, - AGI, - VIT, - INT, - DEX, - LUK, - - ATK, - DEF, - MATK, - MDEF, - HIT, - FLEE, - CRIT - -// KARMA, -// MANNER -}; + enum + { + JOB = 0xa, + + STR = 0xd, + AGI, + VIT, + INT, + DEX, + LUK, + + ATK, + DEF, + MATK, + MDEF, + HIT, + FLEE, + CRIT + +// KARMA, +// MANNER + }; +} enum { diff --git a/src/net/serverinfo.h b/src/net/serverinfo.h index 232ab532a..b4665946c 100644 --- a/src/net/serverinfo.h +++ b/src/net/serverinfo.h @@ -28,6 +28,8 @@ #include #include +#include "localconsts.h" + class ServerInfo { public: diff --git a/src/net/tmwa/protocol.h b/src/net/tmwa/protocol.h index 72952cdd0..72540c54b 100644 --- a/src/net/tmwa/protocol.h +++ b/src/net/tmwa/protocol.h @@ -23,28 +23,31 @@ #ifndef TA_PROTOCOL_H #define TA_PROTOCOL_H -enum +namespace TmwAthena { - JOB = 0xa, - - STR = 0xd, - AGI, - VIT, - INT, - DEX, - LUK, - - ATK, - DEF, - MATK, - MDEF, - HIT, - FLEE, - CRIT - -// KARMA, -// MANNER -}; + enum + { + JOB = 0xa, + + STR = 0xd, + AGI, + VIT, + INT, + DEX, + LUK, + + ATK, + DEF, + MATK, + MDEF, + HIT, + FLEE, + CRIT + +// KARMA, +// MANNER + }; +} enum { -- cgit v1.2.3-70-g09d2