From 4c6264db7ad4f0ae8a6c001903b47741abb94d8c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 29 May 2016 14:55:40 +0300 Subject: Fix code style. --- src/gui/widgets/browserbox.cpp | 6 ++++-- src/gui/widgets/icon.cpp | 2 -- src/gui/windows/charcreatedialog.cpp | 17 ++++++++++++----- src/gui/windows/npcdialog.cpp | 5 ++--- src/net/eathena/playerrecv.cpp | 4 ++-- src/render/shaders/shadersmanager.cpp | 2 -- src/resources/atlas/atlasmanager.cpp | 1 - src/resources/loaders/shaderloader.cpp | 2 +- src/resources/loaders/spritedefloader.cpp | 2 -- src/resources/loaders/subimageloader.cpp | 1 - src/resources/loaders/subimageloader.h | 2 +- src/resources/loaders/subimagesetloader.cpp | 3 --- src/resources/map/objectslayer.cpp | 4 ++-- src/resources/resourcemanager/resourcemanager.cpp | 16 ++-------------- src/resources/resourcemanager/resourcemanager.h | 9 --------- 15 files changed, 26 insertions(+), 50 deletions(-) diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 97ad5ce85..007f2ce2c 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -211,7 +211,7 @@ void BrowserBox::addRow(const std::string &row, const bool atTop) BrowserLink bLink; // Check for links in format "@@link|Caption@@" - const unsigned int sz = mTextRows.size(); + const uint32_t sz = CAST_U32(mTextRows.size()); if (mEnableKeys) { @@ -386,7 +386,9 @@ void BrowserBox::addRow(const std::string &row, const bool atTop) FOR_EACH (TextRowCIter, i, mTextRows) { std::string tempRow = *i; - for (unsigned int j = 0, sz = tempRow.size(); j < sz; j++) + for (uint32_t j = 0, sz = CAST_U32(tempRow.size()); + j < sz; + j++) { const std::string character = tempRow.substr(j, 1); x += CAST_U32(font->getWidth(character)); diff --git a/src/gui/widgets/icon.cpp b/src/gui/widgets/icon.cpp index 76d5d90b0..3b9bdeaf8 100644 --- a/src/gui/widgets/icon.cpp +++ b/src/gui/widgets/icon.cpp @@ -30,8 +30,6 @@ #include "resources/loaders/imageloader.h" -#include "resources/resourcemanager/resourcemanager.h" - #include "debug.h" Icon::Icon(const Widget2 *const widget, diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp index a61008c6c..02ef2686f 100644 --- a/src/gui/windows/charcreatedialog.cpp +++ b/src/gui/windows/charcreatedialog.cpp @@ -664,19 +664,23 @@ void CharCreateDialog::setAttributes(const StringVect &labels, { mAttributeLabel[i] = new Label(this, labels[i]); mAttributeLabel[i]->setWidth(70); - mAttributeLabel[i]->setPosition(mPadding, y + i * 24); + mAttributeLabel[i]->setPosition(mPadding, + y + CAST_S32(i * 24)); mAttributeLabel[i]->adjustSize(); add(mAttributeLabel[i]); mAttributeSlider[i] = new Slider(this, min, max, 1.0); - mAttributeSlider[i]->setDimension(Rect(140 + mPadding, y + i * 24, - 150, 12)); + mAttributeSlider[i]->setDimension(Rect(140 + mPadding, + y + CAST_S32(i * 24), + 150, + 12)); mAttributeSlider[i]->setActionEventId("statslider"); mAttributeSlider[i]->addActionListener(this); add(mAttributeSlider[i]); mAttributeValue[i] = new Label(this, toString(min)); - mAttributeValue[i]->setPosition(295 + mPadding, y + i * 24); + mAttributeValue[i]->setPosition(295 + mPadding, + y + CAST_S32(i * 24)); add(mAttributeValue[i]); } @@ -688,7 +692,10 @@ void CharCreateDialog::setAttributes(const StringVect &labels, } else { - h = y + sz * 24 + mAttributesLeft->getHeight() + getPadding(); + h = y + + CAST_S32(sz) * 24 + + mAttributesLeft->getHeight() + + getPadding(); } if (serverFeatures->haveCreateCharGender() && features.getIntValue("forceCharGender") == -1 && diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index b4323feb6..8b850d463 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -1365,8 +1365,7 @@ std::string NpcDialog::complexItemToStr(const ComplexItem *const item) if (item) { const std::vector &items = item->getChilds(); - const int sz = items.size(); - logger->log("complexItemToStr size=%d", sz); + const size_t sz = items.size(); if (!sz) return str; @@ -1375,7 +1374,7 @@ std::string NpcDialog::complexItemToStr(const ComplexItem *const item) str = strprintf("%d,%d", item2->getInvIndex(), item2->getQuantity()); - for (int f = 1; f < sz; f ++) + for (size_t f = 1; f < sz; f ++) { str.append(";"); item2 = items[f]; diff --git a/src/net/eathena/playerrecv.cpp b/src/net/eathena/playerrecv.cpp index 8ceefa350..eb958a764 100644 --- a/src/net/eathena/playerrecv.cpp +++ b/src/net/eathena/playerrecv.cpp @@ -438,9 +438,9 @@ void PlayerRecv::processKilledBy(Net::MessageIn &msg) const Being *const dstBeing = actorManager->findBeing(id); if (id == BeingId_zero) { - debugMsg(strprintf( + debugMsg( // TRANSLATORS: player killed message - _("You were killed by unknown source."))); + _("You were killed by unknown source.")); } else { diff --git a/src/render/shaders/shadersmanager.cpp b/src/render/shaders/shadersmanager.cpp index f40e570a2..cf7dd81d9 100644 --- a/src/render/shaders/shadersmanager.cpp +++ b/src/render/shaders/shadersmanager.cpp @@ -35,8 +35,6 @@ #include "resources/loaders/shaderloader.h" -#include "resources/resourcemanager/resourcemanager.h" - #include "utils/files.h" #include "debug.h" diff --git a/src/resources/atlas/atlasmanager.cpp b/src/resources/atlas/atlasmanager.cpp index 7a375b243..46f161e6a 100644 --- a/src/resources/atlas/atlasmanager.cpp +++ b/src/resources/atlas/atlasmanager.cpp @@ -35,7 +35,6 @@ #include "resources/imagehelper.h" #include "resources/openglimagehelper.h" -#include "resources/sdlimagehelper.h" #include "resources/atlas/atlasitem.h" #include "resources/atlas/atlasresource.h" diff --git a/src/resources/loaders/shaderloader.cpp b/src/resources/loaders/shaderloader.cpp index 683e4206d..bd5c35dee 100644 --- a/src/resources/loaders/shaderloader.cpp +++ b/src/resources/loaders/shaderloader.cpp @@ -55,7 +55,7 @@ namespace return resource; } }; -} +} // namespace Resource *Loader::getShader(const unsigned int type, const std::string &name) diff --git a/src/resources/loaders/spritedefloader.cpp b/src/resources/loaders/spritedefloader.cpp index 3c68b7c87..d49955ac4 100644 --- a/src/resources/loaders/spritedefloader.cpp +++ b/src/resources/loaders/spritedefloader.cpp @@ -20,7 +20,6 @@ * along with this program. If not, see . */ -#include "logger.h" #include "settings.h" #include "resources/loaders/spritedefloader.h" @@ -29,7 +28,6 @@ #include "resources/sprite/spritedef.h" -#include "utils/checkutils.h" #include "utils/stringutils.h" #include "debug.h" diff --git a/src/resources/loaders/subimageloader.cpp b/src/resources/loaders/subimageloader.cpp index 9d61a305d..1331da245 100644 --- a/src/resources/loaders/subimageloader.cpp +++ b/src/resources/loaders/subimageloader.cpp @@ -29,7 +29,6 @@ #include "resources/resourcemanager/resourcemanager.h" #include "utils/checkutils.h" -#include "utils/physfsrwops.h" #include "utils/stringutils.h" #include "debug.h" diff --git a/src/resources/loaders/subimageloader.h b/src/resources/loaders/subimageloader.h index 222c967e1..05586d6cc 100644 --- a/src/resources/loaders/subimageloader.h +++ b/src/resources/loaders/subimageloader.h @@ -34,6 +34,6 @@ namespace Loader const int y, const int width, const int height) A_WARN_UNUSED; -} // namespace SubImageLoader +} // namespace Loader #endif // RESOURCES_RESOURCEMANAGER_SUBIMAGELOADER_H diff --git a/src/resources/loaders/subimagesetloader.cpp b/src/resources/loaders/subimagesetloader.cpp index 39068bce3..a8db6771a 100644 --- a/src/resources/loaders/subimagesetloader.cpp +++ b/src/resources/loaders/subimagesetloader.cpp @@ -20,8 +20,6 @@ * along with this program. If not, see . */ -#include "logger.h" - #include "resources/image.h" #include "resources/imageset.h" @@ -29,7 +27,6 @@ #include "resources/loaders/subimagesetloader.h" -#include "utils/checkutils.h" #include "utils/stringutils.h" #include "debug.h" diff --git a/src/resources/map/objectslayer.cpp b/src/resources/map/objectslayer.cpp index b121fbcf9..87fe11a94 100644 --- a/src/resources/map/objectslayer.cpp +++ b/src/resources/map/objectslayer.cpp @@ -79,6 +79,6 @@ MapObjectList *ObjectsLayer::getAt(const unsigned x, const unsigned y) const int ObjectsLayer::calcMemoryLocal() const { - return sizeof(ObjectsLayer) + - (sizeof(MapObjectList) + sizeof(MapObjectList*)) * mWidth * mHeight; + return CAST_S32(sizeof(ObjectsLayer) + + (sizeof(MapObjectList) + sizeof(MapObjectList*)) * mWidth * mHeight); } diff --git a/src/resources/resourcemanager/resourcemanager.cpp b/src/resources/resourcemanager/resourcemanager.cpp index b2d4d483d..d61ec9342 100644 --- a/src/resources/resourcemanager/resourcemanager.cpp +++ b/src/resources/resourcemanager/resourcemanager.cpp @@ -24,31 +24,19 @@ #include "configuration.h" #include "logger.h" -#include "navigationmanager.h" - -#include "resources/map/walklayer.h" #ifdef USE_OPENGL -#include "resources/atlas/atlasmanager.h" -#include "resources/atlas/atlasresource.h" -#else // USE_OPENGL #include "resources/image.h" -#endif // USE_OPENGL -#include "resources/imagehelper.h" #include "resources/imageset.h" +#endif // USE_OPENGL #include "resources/memorymanager.h" -#include "resources/dye/dye.h" - -#include "resources/loaders/imageloader.h" - #include "resources/sprite/spritedef.h" #include "utils/checkutils.h" #include "utils/delete2.h" -#include "utils/physfscheckutils.h" #include "utils/physfsrwops.h" -#include "utils/sdlcheckutils.h" +#include "utils/physfstools.h" #ifdef USE_OPENGL #include "render/shaders/shader.h" diff --git a/src/resources/resourcemanager/resourcemanager.h b/src/resources/resourcemanager/resourcemanager.h index caad4bb6e..0a7629257 100644 --- a/src/resources/resourcemanager/resourcemanager.h +++ b/src/resources/resourcemanager/resourcemanager.h @@ -27,21 +27,12 @@ #include "enums/simpletypes/append.h" -#include "utils/stringvector.h" - #include #include #include "localconsts.h" -class Image; -class ImageSet; -class Map; -class SDLMusic; class Resource; -class SoundEffect; -class SpriteDef; -class WalkLayer; struct SDL_Surface; struct SDL_RWops; -- cgit v1.2.3-70-g09d2