From 18b8d9888cd5ee8a533a1059f109d8de1c6b04d1 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 15 Aug 2012 02:20:52 +0300 Subject: Fix code style again. --- src/being.cpp | 2 ++ src/client.cpp | 8 ++++---- src/gui/charcreatedialog.cpp | 4 ++-- src/gui/connectiondialog.h | 2 +- src/gui/killstats.h | 2 +- src/gui/outfitwindow.h | 2 +- src/gui/palette.h | 2 +- src/gui/selldialog.h | 4 +++- src/gui/setup_video.cpp | 4 ++-- src/gui/socialwindow.h | 2 +- src/gui/theme.h | 2 +- src/gui/tradewindow.h | 4 +++- src/gui/widgets/desktop.h | 2 +- src/gui/widgets/window.h | 2 +- src/playerinfo.cpp | 2 +- src/resources/mapreader.cpp | 8 ++++---- src/resources/wallpaper.cpp | 4 ++-- src/sound.h | 16 ++++++++-------- src/statuseffect.cpp | 4 ++-- src/units.cpp | 8 ++++---- src/utils/copynpaste.cpp | 4 ++-- src/utils/stringutils.h | 2 ++ 22 files changed, 49 insertions(+), 41 deletions(-) diff --git a/src/being.cpp b/src/being.cpp index e230d5a5a..b463f3388 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -379,6 +379,7 @@ void Being::setDestination(int dstX, int dstY) return; } +#ifdef MANASERV_SUPPORT // Don't handle flawed destinations from server... if (dstX == 0 || dstY == 0) return; @@ -413,6 +414,7 @@ void Being::setDestination(int dstX, int dstY) mDest.y = static_cast(dest.y); setPath(thisPath); +#endif } void Being::clearPath() diff --git a/src/client.cpp b/src/client.cpp index b636ce2fe..983186ade 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -153,8 +153,8 @@ Graphics *mainGraphics = nullptr; Sound sound; -uint32_t nextTick(uint32_t interval, void *param A_UNUSED); -uint32_t nextSecond(uint32_t interval, void *param A_UNUSED); +static uint32_t nextTick(uint32_t interval, void *param A_UNUSED); +static uint32_t nextSecond(uint32_t interval, void *param A_UNUSED); void ErrorListener::action(const gcn::ActionEvent &) { @@ -183,7 +183,7 @@ extern "C" char const *_nl_locale_name_default(void); * Called every 10 milliseconds by SDL_AddTimer() * @see MILLISECONDS_IN_A_TICK value */ -uint32_t nextTick(uint32_t interval, void *param A_UNUSED) +static uint32_t nextTick(uint32_t interval, void *param A_UNUSED) { tick_time++; if (tick_time == MAX_TICK_VALUE) @@ -195,7 +195,7 @@ uint32_t nextTick(uint32_t interval, void *param A_UNUSED) * Updates fps. * Called every seconds by SDL_AddTimer() */ -uint32_t nextSecond(uint32_t interval, void *param A_UNUSED) +static uint32_t nextSecond(uint32_t interval, void *param A_UNUSED) { fps = frame_count; lps = logic_count; diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp index 693002789..1ef29c93f 100644 --- a/src/gui/charcreatedialog.cpp +++ b/src/gui/charcreatedialog.cpp @@ -58,12 +58,12 @@ #include "debug.h" -const static Being::Action actions[] = +static const Being::Action actions[] = { Being::STAND, Being::SIT, Being::MOVE, Being::ATTACK, Being::DEAD }; -const static uint8_t directions[] = +static const uint8_t directions[] = { Being::DOWN, Being::RIGHT, Being::UP, Being::LEFT }; diff --git a/src/gui/connectiondialog.h b/src/gui/connectiondialog.h index 76d8a952b..a40f7472c 100644 --- a/src/gui/connectiondialog.h +++ b/src/gui/connectiondialog.h @@ -34,7 +34,7 @@ * * \ingroup Interface */ -class ConnectionDialog : public Window, gcn::ActionListener +class ConnectionDialog : public Window, private gcn::ActionListener { public: /** diff --git a/src/gui/killstats.h b/src/gui/killstats.h index 64aef4585..6f21fc6ed 100644 --- a/src/gui/killstats.h +++ b/src/gui/killstats.h @@ -37,7 +37,7 @@ namespace gcn class Label; } -class KillStats : public Window, gcn::ActionListener, public Listener +class KillStats : public Window, private gcn::ActionListener, public Listener { public: /** diff --git a/src/gui/outfitwindow.h b/src/gui/outfitwindow.h index 5c5e4778e..21b78addf 100644 --- a/src/gui/outfitwindow.h +++ b/src/gui/outfitwindow.h @@ -42,7 +42,7 @@ class CheckBox; class Item; class Label; -class OutfitWindow : public Window, gcn::ActionListener +class OutfitWindow : public Window, private gcn::ActionListener { public: /** diff --git a/src/gui/palette.h b/src/gui/palette.h index 235070990..a4ac5d44b 100644 --- a/src/gui/palette.h +++ b/src/gui/palette.h @@ -125,7 +125,7 @@ class Palette */ static void advanceGradients(); - gcn::Color static produceHPColor(int hp, int maxHp, int alpha = 255); + static gcn::Color produceHPColor(int hp, int maxHp, int alpha = 255); protected: /** Colors used for the rainbow gradient */ diff --git a/src/gui/selldialog.h b/src/gui/selldialog.h index dd92e4033..8b1d73ce3 100644 --- a/src/gui/selldialog.h +++ b/src/gui/selldialog.h @@ -47,7 +47,9 @@ namespace gcn * * \ingroup Interface */ -class SellDialog : public Window, gcn::ActionListener, gcn::SelectionListener +class SellDialog : public Window, + private gcn::ActionListener, + private gcn::SelectionListener { public: /** diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index f6b83807a..1e3f843aa 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -109,9 +109,9 @@ class ModeListModel : public gcn::ListModel StringVect mVideoModes; }; -bool modeSorter(std::string mode1, std::string mode2); +static bool modeSorter(std::string mode1, std::string mode2); -bool modeSorter(std::string mode1, std::string mode2) +static bool modeSorter(std::string mode1, std::string mode2) { const int width1 = atoi(mode1.substr(0, mode1.find("x")).c_str()); const int height1 = atoi(mode1.substr(mode1.find("x") + 1).c_str()); diff --git a/src/gui/socialwindow.h b/src/gui/socialwindow.h index 478b62bfe..246f3e127 100644 --- a/src/gui/socialwindow.h +++ b/src/gui/socialwindow.h @@ -49,7 +49,7 @@ class PlayersTab; * * \ingroup Interface */ -class SocialWindow : public Window, gcn::ActionListener +class SocialWindow : public Window, private gcn::ActionListener { public: SocialWindow(); diff --git a/src/gui/theme.h b/src/gui/theme.h index 2a3a4aa2d..75446fdbd 100644 --- a/src/gui/theme.h +++ b/src/gui/theme.h @@ -254,7 +254,7 @@ class Theme : public Palette, public ConfigListener int alpha = 255) { return mInstance->getColor(type, alpha); } - const static gcn::Color &getThemeColor(char c, bool &valid) + static const gcn::Color &getThemeColor(char c, bool &valid) { return mInstance->getColor(c, valid); } static gcn::Color getProgressColor(int type, float progress); diff --git a/src/gui/tradewindow.h b/src/gui/tradewindow.h index c23f006a1..3b6967772 100644 --- a/src/gui/tradewindow.h +++ b/src/gui/tradewindow.h @@ -47,7 +47,9 @@ namespace gcn * * \ingroup Interface */ -class TradeWindow : public Window, gcn::ActionListener, gcn::SelectionListener +class TradeWindow : public Window, + private gcn::ActionListener, + private gcn::SelectionListener { public: /** diff --git a/src/gui/widgets/desktop.h b/src/gui/widgets/desktop.h index 4e8e77003..1ca411732 100644 --- a/src/gui/widgets/desktop.h +++ b/src/gui/widgets/desktop.h @@ -46,7 +46,7 @@ namespace gcn * * \ingroup GUI */ -class Desktop : public Container, gcn::WidgetListener +class Desktop : public Container, private gcn::WidgetListener { public: Desktop(); diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index a006b3995..86f225db4 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -44,7 +44,7 @@ class WindowContainer; * * \ingroup GUI */ -class Window : public gcn::Window, gcn::WidgetListener +class Window : public gcn::Window, private gcn::WidgetListener { public: /** diff --git a/src/playerinfo.cpp b/src/playerinfo.cpp index c22352436..b4ff3ad03 100644 --- a/src/playerinfo.cpp +++ b/src/playerinfo.cpp @@ -317,7 +317,7 @@ void updateAttrs() } } -class PlayerInfoListener : Listener +class PlayerInfoListener : private Listener { public: PlayerInfoListener() diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 4e38d5b0f..8f38b0dab 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -43,11 +43,11 @@ #include "debug.h" -int inflateMemory(unsigned char *in, unsigned int inLength, - unsigned char *&out, unsigned int &outLength); +static int inflateMemory(unsigned char *in, unsigned int inLength, + unsigned char *&out, unsigned int &outLength); -int inflateMemory(unsigned char *in, unsigned int inLength, - unsigned char *&out); +static int inflateMemory(unsigned char *in, unsigned int inLength, + unsigned char *&out); static std::string resolveRelativePath(std::string base, std::string relative) { diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp index 316419627..9ee87e33a 100644 --- a/src/resources/wallpaper.cpp +++ b/src/resources/wallpaper.cpp @@ -44,7 +44,7 @@ struct WallpaperData int height; }; -bool wallpaperCompare(WallpaperData a, WallpaperData b); +static bool wallpaperCompare(WallpaperData a, WallpaperData b); static std::vector wallpaperData; static bool haveBackup; // Is the backup (no size given) version available? @@ -78,7 +78,7 @@ static void initDefaultWallpaperPaths() wallpaperFile = "login_wallpaper.png"; } -bool wallpaperCompare(WallpaperData a, WallpaperData b) +static bool wallpaperCompare(WallpaperData a, WallpaperData b) { int aa = a.width * a.height; int ab = b.width * b.height; diff --git a/src/sound.h b/src/sound.h index a967d0a92..bf9226c18 100644 --- a/src/sound.h +++ b/src/sound.h @@ -31,14 +31,14 @@ class Music; -const static std::string SOUND_INFO = "soundinfo"; -const static std::string SOUND_ERROR = "sounderror"; -const static std::string SOUND_REQUEST = "soundrequest"; -const static std::string SOUND_TRADE = "soundtrade"; -const static std::string SOUND_WHISPER = "soundwhisper"; -const static std::string SOUND_HIGHLIGHT = "soundhighlight"; -const static std::string SOUND_GLOBAL = "soundglobal"; -const static std::string SOUND_GUILD = "soundguild"; +static const std::string SOUND_INFO = "soundinfo"; +static const std::string SOUND_ERROR = "sounderror"; +static const std::string SOUND_REQUEST = "soundrequest"; +static const std::string SOUND_TRADE = "soundtrade"; +static const std::string SOUND_WHISPER = "soundwhisper"; +static const std::string SOUND_HIGHLIGHT = "soundhighlight"; +static const std::string SOUND_GLOBAL = "soundglobal"; +static const std::string SOUND_GUILD = "soundguild"; /** Sound engine * diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp index e8d4b6b5d..e24e873f1 100644 --- a/src/statuseffect.cpp +++ b/src/statuseffect.cpp @@ -37,7 +37,7 @@ #define STATUS_EFFECTS_FILE "status-effects.xml" -void unloadMap(std::map &map); +static void unloadMap(std::map &map); bool StatusEffect::mLoaded = false; @@ -189,7 +189,7 @@ void StatusEffect::load() mLoaded = true; } -void unloadMap(std::map &map) +static void unloadMap(std::map &map) { for (std::map::iterator it = map.begin(); it != map.end(); ++it) diff --git a/src/units.cpp b/src/units.cpp index 9aa1cdf5e..3c4da47e8 100644 --- a/src/units.cpp +++ b/src/units.cpp @@ -55,9 +55,9 @@ enum UnitType UNIT_END }; -std::string formatUnit(int value, int type); +static std::string formatUnit(int value, int type); -std::string splitNumber(std::string str, const std::string &separator); +static std::string splitNumber(std::string str, const std::string &separator); struct UnitDescription units[UNIT_END]; @@ -173,7 +173,7 @@ void Units::loadUnits() } } -std::string formatUnit(int value, int type) +static std::string formatUnit(int value, int type) { struct UnitDescription ud = units[type]; struct UnitLevel ul; @@ -262,7 +262,7 @@ std::string Units::formatWeight(int value) return formatUnit(value, UNIT_WEIGHT); } -std::string splitNumber(std::string str, const std::string &separator) +static std::string splitNumber(std::string str, const std::string &separator) { std::string lastPart; size_t point = str.find("."); diff --git a/src/utils/copynpaste.cpp b/src/utils/copynpaste.cpp index b5dc63449..94cfe9589 100644 --- a/src/utils/copynpaste.cpp +++ b/src/utils/copynpaste.cpp @@ -407,7 +407,7 @@ bool retrieveBuffer(std::string& text, size_t& pos) return false; } -bool runxsel(std::string& text, const char *p1, const char *p2 = nullptr); +static bool runxsel(std::string& text, const char *p1, const char *p2 = nullptr); bool sendBuffer(std::string& text) { @@ -416,7 +416,7 @@ bool sendBuffer(std::string& text) return true; } -bool runxsel(std::string& text, const char *p1, const char *p2) +static bool runxsel(std::string& text, const char *p1, const char *p2) { pid_t pid; int fd[2]; diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h index 92dddebea..2ac31dd2b 100644 --- a/src/utils/stringutils.h +++ b/src/utils/stringutils.h @@ -62,6 +62,8 @@ std::string &toUpper(std::string &str); */ unsigned int atox(const std::string &str); +template std::string toString(const T &arg); + /** * Converts the given value to a string using std::stringstream. * -- cgit v1.2.3-60-g2f50