From 478ffec82dae4f55c38ccd424079166ec8c38905 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 30 May 2015 00:27:14 +0300 Subject: Convert TargetCursorSize enum into strong typed enum. --- src/being/actorsprite.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/being/actorsprite.cpp') diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp index b7e30cacd..eb2268eb9 100644 --- a/src/being/actorsprite.cpp +++ b/src/being/actorsprite.cpp @@ -42,18 +42,18 @@ #include "debug.h" #define for_each_cursors() \ - for (int size = TargetCursorSize::SMALL; \ - size < TargetCursorSize::NUM_TC; \ + for (int size = static_cast(TargetCursorSize::SMALL); \ + size < static_cast(TargetCursorSize::NUM_TC); \ size ++) \ { \ - for (int type = TargetCursorType::NORMAL; \ - type < TargetCursorType::NUM_TCT; \ + for (int type = static_cast(TargetCursorType::NORMAL); \ + type < static_cast(TargetCursorType::NUM_TCT); \ type ++) \ #define end_foreach } AnimatedSprite *ActorSprite::targetCursor[TargetCursorType::NUM_TCT] - [TargetCursorSize::NUM_TC]; + [static_cast(TargetCursorSize::NUM_TC)]; bool ActorSprite::loaded = false; ActorSprite::ActorSprite(const BeingId id) : @@ -157,9 +157,11 @@ void ActorSprite::setTargetType(const TargetCursorType::Type type) mUsedTargetCursor = targetCursor[static_cast(type)][sz]; if (mUsedTargetCursor) { - static const int targetWidths[TargetCursorSize::NUM_TC] + static const int targetWidths[static_cast( + TargetCursorSize::NUM_TC)] = {0, 0, 0}; - static const int targetHeights[TargetCursorSize::NUM_TC] + static const int targetHeights[static_cast( + TargetCursorSize::NUM_TC)] = {-mapTileSize / 2, -mapTileSize / 2, -mapTileSize}; mCursorPaddingX = static_cast(targetWidths[sz]); @@ -361,7 +363,7 @@ static const char *cursorType(const int type) } } -static const char *cursorSize(const int size) +static const char *cursorSize(const TargetCursorSizeT size) { switch (size) { @@ -386,7 +388,7 @@ void ActorSprite::initTargetCursor() Theme::resolveThemePath(strprintf( targetCursorFile.c_str(), cursorType(type), - cursorSize(size)))); + cursorSize(static_cast(size))))); } end_foreach } -- cgit v1.2.3-70-g09d2