From 21f4d82b367750543ebfbc65df23e0863bf48c38 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 17 Jul 2015 22:57:42 +0300 Subject: Fix code style. --- src/gui/gui.cpp | 11 ++++++----- src/gui/viewport.cpp | 3 ++- src/localconsts.h | 8 ++++++-- src/resources/db/itemdb.cpp | 1 + src/resources/map/mapheights.h | 3 ++- src/utils/translation/poparser.cpp | 2 -- 6 files changed, 17 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 50a0a6a28..c4c69afa1 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -1170,12 +1170,12 @@ void Gui::handleMouseWheelMovedDown(const MouseInput& mouseInput) if (mFocusHandler->getDraggedWidget()) sourceWidget = mFocusHandler->getDraggedWidget(); - int sourceWidgetX = 0; - int sourceWidgetY = 0; if (sourceWidget) { - sourceWidget->getAbsolutePosition(sourceWidgetX, sourceWidgetY); + int sourceWidgetX = 0; + int sourceWidgetY = 0; + sourceWidget->getAbsolutePosition(sourceWidgetX, sourceWidgetY); distributeMouseEvent(sourceWidget, MouseEventType::WHEEL_MOVED_DOWN, mouseInput.getButton(), @@ -1192,10 +1192,11 @@ void Gui::handleMouseWheelMovedUp(const MouseInput& mouseInput) if (mFocusHandler->getDraggedWidget()) sourceWidget = mFocusHandler->getDraggedWidget(); - int sourceWidgetX; - int sourceWidgetY; if (sourceWidget) { + int sourceWidgetX; + int sourceWidgetY; + sourceWidget->getAbsolutePosition(sourceWidgetX, sourceWidgetY); distributeMouseEvent(sourceWidget, MouseEventType::WHEEL_MOVED_UP, diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 2ef6b836d..ca301d8e8 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -680,7 +680,8 @@ void Viewport::walkByMouse(const MouseEvent &event) const int clickY = event.getY() + mPixelViewY - 16; destY = event.getY() + mPixelViewY; int newDiffY = 1000000; - const int heightTiles = mainGraphics->mHeight / mMap->getTileHeight(); + const int heightTiles = mainGraphics->mHeight + / mMap->getTileHeight(); const int tileViewY = mPixelViewY / 32; for (int f = tileViewY; f < tileViewY + heightTiles; f ++) { diff --git a/src/localconsts.h b/src/localconsts.h index 3620d441f..f54ae5659 100644 --- a/src/localconsts.h +++ b/src/localconsts.h @@ -71,11 +71,15 @@ #define DEPRECATED __attribute__ ((deprecated)) #define restrict __restrict__ +#ifdef __INTEL_COMPILER +#define RETURNS_NONNULL +#else // __INTEL_COMPILER #if GCC_VERSION < 40900 #define RETURNS_NONNULL -#else +#else // GCC_VERSION < 40900 #define RETURNS_NONNULL __attribute__((returns_nonnull)) -#endif +#endif // GCC_VERSION < 40900 +#endif // __INTEL_COMPILER #ifndef ENABLE_CILKPLUS #define A_NONNULL(...) __attribute__((nonnull (__VA_ARGS__))) diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp index ad6d8f3e9..203858fa8 100644 --- a/src/resources/db/itemdb.cpp +++ b/src/resources/db/itemdb.cpp @@ -350,6 +350,7 @@ void ItemDB::loadXmlFile(const std::string &fileName, int &tagNum) case ItemType::USABLE: itemInfo->addTag(mTags["Usable"]); break; + case ItemType::CARD: case ItemType::UNUSABLE: itemInfo->addTag(mTags["Unusable"]); break; diff --git a/src/resources/map/mapheights.h b/src/resources/map/mapheights.h index 149645b3d..5a5fa8243 100644 --- a/src/resources/map/mapheights.h +++ b/src/resources/map/mapheights.h @@ -37,7 +37,8 @@ class MapHeights final void setHeight(const int x, const int y, const uint8_t height); uint8_t getHeight(const int x, const int y) const - { return x < mWidth && y < mHeight ? mTiles[x + y * mWidth] : 0; } + { return x < mWidth && y < mHeight ? mTiles[x + y * mWidth] + : static_cast(0U); } private: int mWidth; diff --git a/src/utils/translation/poparser.cpp b/src/utils/translation/poparser.cpp index 19f5443e9..3866322f5 100644 --- a/src/utils/translation/poparser.cpp +++ b/src/utils/translation/poparser.cpp @@ -20,8 +20,6 @@ #include "utils/translation/poparser.h" -#include "resources/resourcemanager.h" - #include "utils/physfstools.h" #include "utils/stringutils.h" -- cgit v1.2.3-70-g09d2