From 24a5939846bf593e17e09f3564d941a7c2a5bf27 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 14 Jan 2014 21:47:02 +0300 Subject: fix code style. --- src/being/being.cpp | 7 +++---- src/being/being.h | 3 +-- src/game.cpp | 1 - src/gui/gui.cpp | 6 +++--- src/gui/widgets/progressbar.cpp | 1 + src/gui/widgets/tabs/setup_mods.cpp | 3 +-- src/gui/widgets/tabs/setup_mods.h | 2 +- src/gui/widgets/textfield.cpp | 1 - src/gui/windows/updaterwindow.cpp | 3 ++- src/input/inputmanager.cpp | 2 +- src/resources/beingcommon.cpp | 3 --- src/resources/db/avatardb.h | 2 +- src/resources/db/colordb.cpp | 3 +-- src/resources/db/moddb.h | 2 +- src/resources/db/monsterdb.h | 2 +- src/resources/db/petdb.h | 2 +- src/resources/db/sounddb.h | 2 +- src/utils/files.cpp | 6 +++--- 18 files changed, 22 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/being/being.cpp b/src/being/being.cpp index 6e5fa5e92..641f8abd6 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -917,7 +917,7 @@ const Guild *Being::getGuild(const std::string &guildName) const { FOR_EACH (GuildsMapCIter, itr, mGuilds) { - Guild *const guild = itr->second; + const Guild *const guild = itr->second; if (guild && guild->getName() == guildName) return guild; } @@ -3298,12 +3298,11 @@ void Being::updatePets() } } -void Being::unassignPet(Being *const pet1) +void Being::unassignPet(const Being *const pet1) { FOR_EACH (std::vector::iterator, it, mPets) { - Being *const pet = *it; - if (pet == pet1) + if (*it == pet1) { mPets.erase(it); return; diff --git a/src/being/being.h b/src/being/being.h index 56319c352..7314fe1f1 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -892,7 +892,7 @@ class Being : public ActorSprite, public ConfigListener void setOwner(Being *const owner) { mOwner = owner; } - void unassignPet(Being *const pet); + void unassignPet(const Being *const pet); void removeAllPets(); @@ -1088,7 +1088,6 @@ class Being : public ActorSprite, public ConfigListener int mCriticalHit; unsigned int mPvpRank; unsigned int mNumber; - int mPetId; int mLook; int mUsageCounter; unsigned char mHairColor; diff --git a/src/game.cpp b/src/game.cpp index 8d11d222c..e22b79715 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -558,7 +558,6 @@ bool Game::saveScreenshot(SDL_Surface *const screenshot) { if (localChatTab) { - std::stringstream chatlogentry; // TRANSLATORS: save file message std::string str = strprintf(_("Screenshot saved as %s"), filenameSuffix.str().c_str()); diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 8dbaec952..a8c31469a 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -151,7 +151,7 @@ void Gui::postInit(Graphics *const graphics) if (fontFile.empty()) fontFile = branding.getStringValue("japanFont"); } - else if(isChinese) + else if (isChinese) { fontFile = config.getValue("chinaFont", ""); if (fontFile.empty()) @@ -179,7 +179,7 @@ void Gui::postInit(Graphics *const graphics) if (fontFile.empty()) fontFile = branding.getStringValue("japanFont"); } - else if(isChinese) + else if (isChinese) { fontFile = config.getValue("chinaFont", ""); if (fontFile.empty()) @@ -257,7 +257,7 @@ void Gui::postInit(Graphics *const graphics) if (fontFile.empty()) fontFile = branding.getStringValue("japanFont"); } - else if(isChinese) + else if (isChinese) { fontFile = config.getValue("chinaFont", ""); if (fontFile.empty()) diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index 6454cf47a..aecb323f8 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -46,6 +46,7 @@ ProgressBar::ProgressBar(const Widget2 *const widget, float progress, mSkin(nullptr), mProgress(progress), mProgressToGo(progress), + mBackgroundColorToGo(), mText(), mVertexes(new ImageCollection), mProgressPalette(backColor), diff --git a/src/gui/widgets/tabs/setup_mods.cpp b/src/gui/widgets/tabs/setup_mods.cpp index f6b43183c..ada0ef686 100644 --- a/src/gui/widgets/tabs/setup_mods.cpp +++ b/src/gui/widgets/tabs/setup_mods.cpp @@ -23,7 +23,6 @@ #include "gui/widgets/tabs/setup_mods.h" #include "configuration.h" -#include "map.h" #include "gui/widgets/layouthelper.h" #include "gui/widgets/setupitem.h" @@ -96,7 +95,7 @@ void Setup_Mods::loadMods() } } -void Setup_Mods::saveMods() +void Setup_Mods::saveMods() const { const ModInfos &mods = ModDB::getAll(); if (mods.empty()) diff --git a/src/gui/widgets/tabs/setup_mods.h b/src/gui/widgets/tabs/setup_mods.h index 6c5c519fd..c385aca08 100644 --- a/src/gui/widgets/tabs/setup_mods.h +++ b/src/gui/widgets/tabs/setup_mods.h @@ -42,7 +42,7 @@ class Setup_Mods final : public SetupTabScroll void loadMods(); - void saveMods(); + void saveMods() const; protected: }; diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index b4d72a1a7..07fde23cd 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -26,7 +26,6 @@ #include "input/inputmanager.h" -#include "input/keydata.h" #include "input/keyevent.h" #include "gui/sdlinput.h" diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index 01b1b65cc..fcb26cc36 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -656,7 +656,8 @@ void UpdaterWindow::loadManaPlusUpdates(const std::string &dir, if (strStartWith(name, "manaplus_")) { struct stat statbuf; - std::string fileName = std::string(fixPath).append("/").append(name); + std::string fileName = std::string(fixPath).append( + "/").append(name); if (!stat(fileName.c_str(), &statbuf)) resman->addToSearchPath(fileName, false); } diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp index 645bfe351..090629aea 100644 --- a/src/input/inputmanager.cpp +++ b/src/input/inputmanager.cpp @@ -714,7 +714,7 @@ void InputManager::updateConditionMask() bool InputManager::checkKey(const KeyData *const key) const { - //logger->log("checkKey mask=%d, condition=%d", mMask, key->condition); + // logger->log("checkKey mask=%d, condition=%d", mMask, key->condition); if (!key || (key->condition & mMask) != key->condition) return false; diff --git a/src/resources/beingcommon.cpp b/src/resources/beingcommon.cpp index 3e3a81cbf..668d67259 100644 --- a/src/resources/beingcommon.cpp +++ b/src/resources/beingcommon.cpp @@ -20,10 +20,7 @@ #include "resources/beingcommon.h" -#include "logger.h" - #include "utils/files.h" -#include "utils/physfstools.h" #include "utils/stringutils.h" #include "resources/beinginfo.h" diff --git a/src/resources/db/avatardb.h b/src/resources/db/avatardb.h index f86ac4882..ba2d8ad47 100644 --- a/src/resources/db/avatardb.h +++ b/src/resources/db/avatardb.h @@ -38,6 +38,6 @@ namespace AvatarDB BeingInfo *get(const int id) A_WARN_UNUSED; void loadXmlFile(const std::string &fileName); -} +} // namespace AvatarDB #endif // RESOURCES_DB_AVATARDB_H diff --git a/src/resources/db/colordb.cpp b/src/resources/db/colordb.cpp index e4d5b83a0..34e0614c0 100644 --- a/src/resources/db/colordb.cpp +++ b/src/resources/db/colordb.cpp @@ -79,7 +79,6 @@ void ColorDB::loadHair(const std::string &fileName, { XML::Document *doc = new XML::Document(fileName); XmlNodePtr root = doc->rootNode(); - bool hairXml = true; if (!root || !xmlNameEqual(root, "colors")) { @@ -107,7 +106,7 @@ void ColorDB::loadHair(const std::string &fileName, logger->log("ColorDB: Redefinition of dye ID %d", id); colors[id] = ItemColor(id, XML::langProperty(node, "name", ""), - XML::getProperty(node, hairXml ? "value" : "dye", "#FFFFFF")); + XML::getProperty(node, "value", "#FFFFFF")); } } diff --git a/src/resources/db/moddb.h b/src/resources/db/moddb.h index b09c47747..f1bf1b25d 100644 --- a/src/resources/db/moddb.h +++ b/src/resources/db/moddb.h @@ -42,6 +42,6 @@ namespace ModDB void loadXmlFile(const std::string &fileName); const ModInfos &getAll(); -} +} // namespace ModDB #endif // RESOURCES_DB_MODDB_H diff --git a/src/resources/db/monsterdb.h b/src/resources/db/monsterdb.h index a4be8213e..9de5bde3a 100644 --- a/src/resources/db/monsterdb.h +++ b/src/resources/db/monsterdb.h @@ -41,6 +41,6 @@ namespace MonsterDB void loadXmlFile(const std::string &fileName); BeingInfo *get(const int id) A_WARN_UNUSED; -} +} // namespace MonsterDB #endif // RESOURCES_DB_MONSTERDB_H diff --git a/src/resources/db/petdb.h b/src/resources/db/petdb.h index 75175f5c5..17ef7b287 100644 --- a/src/resources/db/petdb.h +++ b/src/resources/db/petdb.h @@ -38,6 +38,6 @@ namespace PETDB void unload(); BeingInfo *get(const int id) A_WARN_UNUSED; -} +} // namespace PETDB #endif // RESOURCES_DB_PETDB_H diff --git a/src/resources/db/sounddb.h b/src/resources/db/sounddb.h index 5d1361088..eca7286a2 100644 --- a/src/resources/db/sounddb.h +++ b/src/resources/db/sounddb.h @@ -34,6 +34,6 @@ namespace SoundDB void unload(); std::string &getSound(const int id); -} +} // namespace SoundDB #endif // RESOURCES_DB_SOUNDDB_H diff --git a/src/utils/files.cpp b/src/utils/files.cpp index 39451b129..24ec9366e 100644 --- a/src/utils/files.cpp +++ b/src/utils/files.cpp @@ -200,7 +200,7 @@ int Files::copyFile(const std::string &restrict srcName, void Files::getFiles(const std::string &path, StringVect &list) { char **fonts = PhysFs::enumerateFiles(path.c_str()); - for (char **i = fonts; *i; i++) + for (char *const *i = fonts; *i; i++) { if (!PhysFs::isDirectory((path + *i).c_str())) list.push_back(*i); @@ -211,7 +211,7 @@ void Files::getFiles(const std::string &path, StringVect &list) void Files::getDirs(const std::string &path, StringVect &list) { char **fonts = PhysFs::enumerateFiles(path.c_str()); - for (char **i = fonts; *i; i++) + for (char *const *i = fonts; *i; i++) { if (PhysFs::isDirectory((path + *i).c_str())) list.push_back(*i); @@ -222,7 +222,7 @@ void Files::getDirs(const std::string &path, StringVect &list) void Files::getFilesWithDir(const std::string &path, StringVect &list) { char **fonts = PhysFs::enumerateFiles(path.c_str()); - for (char **i = fonts; *i; i++) + for (char *const *i = fonts; *i; i++) { if (!PhysFs::isDirectory((path + *i).c_str())) list.push_back(path + *i); -- cgit v1.2.3-60-g2f50