From c635347f18378aea08ba48e991ddb8ff1010c27c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 1 Mar 2013 16:00:26 +0300 Subject: Fix code style. --- src/commands.cpp | 4 ++-- src/configuration.cpp | 57 ++++++++++++++++++++++++++------------------ src/depricatedevent.cpp | 12 +++++----- src/effectmanager.h | 4 ++-- src/game.cpp | 3 ++- src/graphicsmanager.cpp | 3 ++- src/gui/updaterwindow.cpp | 5 ++-- src/localplayer.h | 2 +- src/net/ea/playerhandler.cpp | 4 ++-- src/resources/wallpaper.cpp | 1 - 10 files changed, 54 insertions(+), 41 deletions(-) diff --git a/src/commands.cpp b/src/commands.cpp index 83160188f..c86497f15 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -332,8 +332,8 @@ impHandler(query) if (tab) { - tab->chatLog(strprintf(_("Cannot create a whisper tab for nick \"%s\"! " - "It either already exists, or is you."), + tab->chatLog(strprintf(_("Cannot create a whisper tab for nick " + "\"%s\"! It either already exists, or is you."), args.c_str()), BY_SERVER); } } diff --git a/src/configuration.cpp b/src/configuration.cpp index fa0d1dc18..34d301446 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -365,21 +365,22 @@ int Configuration::getIntValue(const std::string &key) const if (itdef != mDefaultsData->end() && itdef->second) { - VariableData *const data = itdef->second; + const VariableData *const data = itdef->second; const VariableData::DataType type = static_cast(data->getType()); if (type == VariableData::DATA_INT) { - defaultValue = (static_cast(data))->getData(); + defaultValue = (static_cast( + data))->getData(); } else if (type == VariableData::DATA_STRING) { - defaultValue = atoi((static_cast( + defaultValue = atoi((static_cast( data))->getData().c_str()); } else if (type == VariableData::DATA_BOOL) { - if ((static_cast(data))->getData()) + if ((static_cast(data))->getData()) defaultValue = 1; else defaultValue = 0; @@ -387,7 +388,7 @@ int Configuration::getIntValue(const std::string &key) const else if (type == VariableData::DATA_FLOAT) { defaultValue = static_cast( - (static_cast(data))->getData()); + (static_cast(data))->getData()); } } else @@ -411,11 +412,12 @@ int Configuration::resetIntValue(const std::string &key) if (mDefaultsData) { const DefaultsData::const_iterator itdef = mDefaultsData->find(key); - VariableData *const data = itdef->second; + const VariableData *const data = itdef->second; if (itdef != mDefaultsData->end() && data && data->getType() == VariableData::DATA_INT) { - defaultValue = (static_cast(data))->getData(); + defaultValue = (static_cast( + data))->getData(); } else { @@ -441,23 +443,24 @@ std::string Configuration::getStringValue(const std::string &key) const if (itdef != mDefaultsData->end() && itdef->second) { - VariableData *const data = itdef->second; + const VariableData *const data = itdef->second; const VariableData::DataType type = static_cast(data->getType()); if (type == VariableData::DATA_STRING) { - defaultValue = (static_cast(data))->getData(); + defaultValue = (static_cast( + data))->getData(); } else if (type == VariableData::DATA_BOOL) { - if ((static_cast(data))->getData()) + if ((static_cast(data))->getData()) defaultValue = "1"; else defaultValue = "0"; } else if (type == VariableData::DATA_INT) { - defaultValue = toString((static_cast( + defaultValue = toString((static_cast( data))->getData()); } } @@ -490,29 +493,31 @@ float Configuration::getFloatValue(const std::string &key) const if (itdef != mDefaultsData->end() && itdef->second) { - VariableData *const data = itdef->second; + const VariableData *const data = itdef->second; const VariableData::DataType type = static_cast< VariableData::DataType>(data->getType()); if (type == VariableData::DATA_FLOAT) { defaultValue = static_cast( - (static_cast(data))->getData()); + (static_cast(data))->getData()); } else if (type == VariableData::DATA_STRING) { defaultValue = static_cast(atof(( - static_cast(data))->getData().c_str())); + static_cast( + data))->getData().c_str())); } else if (type == VariableData::DATA_BOOL) { - if ((static_cast(data))->getData()) + if ((static_cast(data))->getData()) defaultValue = 1; else defaultValue = 0; } else if (type == VariableData::DATA_INT) { - defaultValue = static_cast((static_cast( + defaultValue = static_cast(( + static_cast( data))->getData()); } } @@ -544,30 +549,36 @@ bool Configuration::getBoolValue(const std::string &key) const if (itdef != mDefaultsData->end() && itdef->second) { - VariableData *const data = itdef->second; + const VariableData *const data = itdef->second; const VariableData::DataType type = static_cast< VariableData::DataType>(data->getType()); if (type == VariableData::DATA_BOOL) { - defaultValue = (static_cast(data))->getData(); + defaultValue = (static_cast( + data))->getData(); } else if (type == VariableData::DATA_INT) { - if ((static_cast(data))->getData() != 0) + if ((static_cast(data))->getData() != 0) defaultValue = true; else defaultValue = false; } else if (type == VariableData::DATA_STRING) { - if ((static_cast(data))->getData() != "0") + if ((static_cast( + data))->getData() != "0") + { defaultValue = true; + } else + { defaultValue = false; + } } if (type == VariableData::DATA_FLOAT) { - if (static_cast((static_cast( + if (static_cast((static_cast( data))->getData()) != 0) { defaultValue = true; @@ -600,12 +611,12 @@ bool Configuration::resetBoolValue(const std::string &key) if (mDefaultsData) { const DefaultsData::const_iterator itdef = mDefaultsData->find(key); - VariableData *const data = itdef->second; + const VariableData *const data = itdef->second; if (itdef != mDefaultsData->end() && data && data->getType() == VariableData::DATA_BOOL) { - defaultValue = (static_cast(data))->getData(); + defaultValue = (static_cast(data))->getData(); } else { diff --git a/src/depricatedevent.cpp b/src/depricatedevent.cpp index 9cb37ac85..11ea29311 100644 --- a/src/depricatedevent.cpp +++ b/src/depricatedevent.cpp @@ -53,11 +53,11 @@ int DepricatedEvent::getInt(const std::string &key) const if (it == mData.end()) return 0; - VariableData *const data = it->second; + const VariableData *const data = it->second; if (!data || data->getType() != VariableData::DATA_INT) return 0; - return static_cast(data)->getData(); + return static_cast(data)->getData(); } void DepricatedEvent::setString(const std::string &key, @@ -75,11 +75,11 @@ const std::string DepricatedEvent::getString(const std::string &key) const if (it == mData.end()) return ""; - VariableData *const data = it->second; + const VariableData *const data = it->second; if (!data || data->getType() != VariableData::DATA_STRING) return ""; - return static_cast(data)->getData(); + return static_cast(data)->getData(); } @@ -97,11 +97,11 @@ double DepricatedEvent::getFloat(const std::string &key) const if (it == mData.end()) return 0; - VariableData *const data = it->second; + const VariableData *const data = it->second; if (!data || data->getType() != VariableData::DATA_FLOAT) return 0; - return static_cast(data)->getData(); + return static_cast(data)->getData(); } void DepricatedEvent::trigger(const Channels channel, diff --git a/src/effectmanager.h b/src/effectmanager.h index d8bbd691b..fca033d97 100644 --- a/src/effectmanager.h +++ b/src/effectmanager.h @@ -37,8 +37,8 @@ class EffectManager final public: struct EffectDescription { - EffectDescription(int id0, const std::string GFX0, - const std::string SFX0) : + EffectDescription(const int id0, const std::string &GFX0, + const std::string &SFX0) : id(id0), GFX(GFX0), SFX(SFX0) diff --git a/src/game.cpp b/src/game.cpp index 7645a669b..fa93f4d84 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1045,7 +1045,8 @@ void Game::changeMap(const std::string &mapPath) newMap->initializeParticleEffects(particleEngine); // Start playing new music file when necessary - const std::string oldMusic = mCurrentMap ? mCurrentMap->getMusicFile() : ""; + const std::string oldMusic = mCurrentMap + ? mCurrentMap->getMusicFile() : ""; const std::string newMusic = newMap ? newMap->getMusicFile() : ""; if (newMusic != oldMusic) { diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp index eae856ea4..935e9ca55 100644 --- a/src/graphicsmanager.cpp +++ b/src/graphicsmanager.cpp @@ -606,7 +606,8 @@ bool GraphicsManager::checkGLVersion(const int major, const int minor) const return mMajor > major || (mMajor == major && mMinor >= minor); } -bool GraphicsManager::checkPlatformVersion(const int major, const int minor) const +bool GraphicsManager::checkPlatformVersion(const int major, + const int minor) const { return mPlatformMajor > major || (mPlatformMajor == major && mPlatformMinor >= minor); diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp index e99d9144e..fb102f724 100644 --- a/src/gui/updaterwindow.cpp +++ b/src/gui/updaterwindow.cpp @@ -748,8 +748,9 @@ void UpdaterWindow::logic() std::ifstream temp((std::string(mUpdatesDir).append( "/").append(mCurrentFile)).c_str()); - if (!temp.is_open() || !validateFile(std::string(mUpdatesDir).append( - "/").append(mCurrentFile), mCurrentChecksum)) + if (!temp.is_open() || !validateFile(std::string( + mUpdatesDir).append("/").append(mCurrentFile), + mCurrentChecksum)) { temp.close(); download(); diff --git a/src/localplayer.h b/src/localplayer.h index 7315861ed..dcb95a119 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -513,7 +513,7 @@ class LocalPlayer final : public Being, void changeEquipmentBeforeAttack(const Being *const target) const; static void tryMagic(const std::string &spell, const int baseMagic, - const int schoolMagic, const int mana); + const int schoolMagic, const int mana); const char *getVarItem(const char *const *const arr, const unsigned index, diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 81bc373f3..8592b737b 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -472,8 +472,8 @@ void PlayerHandler::processPlayerStatUpdate2(Net::MessageIn &msg) PlayerInfo::setAttribute(PlayerInfo::EXP_NEEDED, msg.readInt32()); break; case 0x0017: - PlayerInfo::setStatExperience(EA_JOB, PlayerInfo::getStatExperience( - EA_JOB).first, msg.readInt32()); + PlayerInfo::setStatExperience(EA_JOB, + PlayerInfo::getStatExperience(EA_JOB).first, msg.readInt32()); break; default: logger->log("QQQQ PLAYER_STAT_UPDATE_2 " + toString(type)); diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp index 4f518f083..4b7219e7b 100644 --- a/src/resources/wallpaper.cpp +++ b/src/resources/wallpaper.cpp @@ -28,7 +28,6 @@ #include "resources/resourcemanager.h" #include "utils/physfstools.h" -#include "utils/stringutils.h" #include #include -- cgit v1.2.3-60-g2f50