diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-03-01 16:00:26 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-03-01 16:00:26 +0300 |
commit | c635347f18378aea08ba48e991ddb8ff1010c27c (patch) | |
tree | 835b7c57d3891f7944447d9a488ad7d490480e18 | |
parent | 5a35288a7524c6b5cb9a4e8e3aa93d756b016743 (diff) | |
download | manaverse-c635347f18378aea08ba48e991ddb8ff1010c27c.tar.gz manaverse-c635347f18378aea08ba48e991ddb8ff1010c27c.tar.bz2 manaverse-c635347f18378aea08ba48e991ddb8ff1010c27c.tar.xz manaverse-c635347f18378aea08ba48e991ddb8ff1010c27c.zip |
Fix code style.
-rw-r--r-- | src/commands.cpp | 4 | ||||
-rw-r--r-- | src/configuration.cpp | 57 | ||||
-rw-r--r-- | src/depricatedevent.cpp | 12 | ||||
-rw-r--r-- | src/effectmanager.h | 4 | ||||
-rw-r--r-- | src/game.cpp | 3 | ||||
-rw-r--r-- | src/graphicsmanager.cpp | 3 | ||||
-rw-r--r-- | src/gui/updaterwindow.cpp | 5 | ||||
-rw-r--r-- | src/localplayer.h | 2 | ||||
-rw-r--r-- | src/net/ea/playerhandler.cpp | 4 | ||||
-rw-r--r-- | 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<const VariableData::DataType>(data->getType()); if (type == VariableData::DATA_INT) { - defaultValue = (static_cast<IntData*>(data))->getData(); + defaultValue = (static_cast<const IntData*>( + data))->getData(); } else if (type == VariableData::DATA_STRING) { - defaultValue = atoi((static_cast<StringData*>( + defaultValue = atoi((static_cast<const StringData*>( data))->getData().c_str()); } else if (type == VariableData::DATA_BOOL) { - if ((static_cast<BoolData*>(data))->getData()) + if ((static_cast<const BoolData*>(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<int>( - (static_cast<FloatData*>(data))->getData()); + (static_cast<const FloatData*>(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<IntData*>(data))->getData(); + defaultValue = (static_cast<const IntData*>( + 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<const VariableData::DataType>(data->getType()); if (type == VariableData::DATA_STRING) { - defaultValue = (static_cast<StringData*>(data))->getData(); + defaultValue = (static_cast<const StringData*>( + data))->getData(); } else if (type == VariableData::DATA_BOOL) { - if ((static_cast<BoolData*>(data))->getData()) + if ((static_cast<const BoolData*>(data))->getData()) defaultValue = "1"; else defaultValue = "0"; } else if (type == VariableData::DATA_INT) { - defaultValue = toString((static_cast<IntData*>( + defaultValue = toString((static_cast<const IntData*>( 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<float>( - (static_cast<FloatData*>(data))->getData()); + (static_cast<const FloatData*>(data))->getData()); } else if (type == VariableData::DATA_STRING) { defaultValue = static_cast<float>(atof(( - static_cast<StringData*>(data))->getData().c_str())); + static_cast<const StringData*>( + data))->getData().c_str())); } else if (type == VariableData::DATA_BOOL) { - if ((static_cast<BoolData*>(data))->getData()) + if ((static_cast<const BoolData*>(data))->getData()) defaultValue = 1; else defaultValue = 0; } else if (type == VariableData::DATA_INT) { - defaultValue = static_cast<float>((static_cast<IntData*>( + defaultValue = static_cast<float>(( + static_cast<const IntData*>( 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<BoolData*>(data))->getData(); + defaultValue = (static_cast<const BoolData*>( + data))->getData(); } else if (type == VariableData::DATA_INT) { - if ((static_cast<IntData*>(data))->getData() != 0) + if ((static_cast<const IntData*>(data))->getData() != 0) defaultValue = true; else defaultValue = false; } else if (type == VariableData::DATA_STRING) { - if ((static_cast<StringData*>(data))->getData() != "0") + if ((static_cast<const StringData*>( + data))->getData() != "0") + { defaultValue = true; + } else + { defaultValue = false; + } } if (type == VariableData::DATA_FLOAT) { - if (static_cast<int>((static_cast<FloatData*>( + if (static_cast<int>((static_cast<const FloatData*>( 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<BoolData*>(data))->getData(); + defaultValue = (static_cast<const BoolData*>(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<IntData *>(data)->getData(); + return static_cast<const IntData *>(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<StringData *>(data)->getData(); + return static_cast<const StringData *>(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<FloatData *>(data)->getData(); + return static_cast<const FloatData *>(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 <algorithm> #include <cstring> |