diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-08-22 01:45:59 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-08-22 01:45:59 +0300 |
commit | ad56ac4bda60beddf33640df346801af1ece9ccf (patch) | |
tree | 80b27c32a9e954dd747e261d4f7617e4c959bb26 /src/being | |
parent | c0b08d3f4f554c16e9a3599f1f1063c3a283bb93 (diff) | |
download | plus-ad56ac4bda60beddf33640df346801af1ece9ccf.tar.gz plus-ad56ac4bda60beddf33640df346801af1ece9ccf.tar.bz2 plus-ad56ac4bda60beddf33640df346801af1ece9ccf.tar.xz plus-ad56ac4bda60beddf33640df346801af1ece9ccf.zip |
Add strong typed enum DisplayType.
Diffstat (limited to 'src/being')
-rw-r--r-- | src/being/actorsprite.cpp | 8 | ||||
-rw-r--r-- | src/being/actorsprite.h | 4 | ||||
-rw-r--r-- | src/being/being.cpp | 16 | ||||
-rw-r--r-- | src/being/flooritem.cpp | 2 |
4 files changed, 16 insertions, 14 deletions
diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp index 6c2c99a40..6594c7e3c 100644 --- a/src/being/actorsprite.cpp +++ b/src/being/actorsprite.cpp @@ -429,7 +429,7 @@ void ActorSprite::handleStatusEffect(const StatusEffect *const effect, void ActorSprite::setupSpriteDisplay(const SpriteDisplay &display, const ForceDisplay forceDisplay, - const int imageType, + const DisplayTypeT displayType, const std::string &color) { clear(); @@ -457,14 +457,14 @@ void ActorSprite::setupSpriteDisplay(const SpriteDisplay &display, else { std::string imagePath; - switch (imageType) + switch (displayType) { - case 0: + case DisplayType::Item: default: imagePath = pathJoin(paths.getStringValue("itemIcons"), display.image); break; - case 1: + case DisplayType::Floor: imagePath = pathJoin(paths.getStringValue("itemIcons"), display.floor); break; diff --git a/src/being/actorsprite.h b/src/being/actorsprite.h index ff413f040..db912e059 100644 --- a/src/being/actorsprite.h +++ b/src/being/actorsprite.h @@ -36,6 +36,8 @@ #include "enums/simpletypes/forcedisplay.h" #include "enums/simpletypes/isstart.h" +#include "enums/resources/displaytype.h" + #include "enums/resources/map/blocktype.h" #include "particle/particlelist.h" @@ -228,7 +230,7 @@ class ActorSprite notfinal : public CompoundSprite, public Actor void setupSpriteDisplay(const SpriteDisplay &display, const ForceDisplay forceDisplay, - const int imageType, + const DisplayTypeT displayType, const std::string &color); /** Load the target cursors into memory */ diff --git a/src/being/being.cpp b/src/being/being.cpp index e43b71600..be998d05d 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -388,7 +388,7 @@ void Being::setSubtype(const BeingTypeId subtype, setName(mInfo->getName()); setupSpriteDisplay(mInfo->getDisplay(), ForceDisplay_true, - 0, + DisplayType::Item, mInfo->getColor(fromInt(mLook, ItemColor))); mYDiff = mInfo->getSortOffsetY(); } @@ -400,7 +400,7 @@ void Being::setSubtype(const BeingTypeId subtype, setName(mInfo->getName()); setupSpriteDisplay(mInfo->getDisplay(), ForceDisplay_true, - 0, + DisplayType::Item, mInfo->getColor(fromInt(mLook, ItemColor))); mYDiff = mInfo->getSortOffsetY(); } @@ -412,7 +412,7 @@ void Being::setSubtype(const BeingTypeId subtype, setName(mInfo->getName()); setupSpriteDisplay(mInfo->getDisplay(), ForceDisplay_true, - 0, + DisplayType::Item, mInfo->getColor(fromInt(mLook, ItemColor))); mYDiff = mInfo->getSortOffsetY(); } @@ -424,7 +424,7 @@ void Being::setSubtype(const BeingTypeId subtype, setName(mInfo->getName()); setupSpriteDisplay(mInfo->getDisplay(), ForceDisplay_true, - 0, + DisplayType::Item, mInfo->getColor(fromInt(mLook, ItemColor))); mYDiff = mInfo->getSortOffsetY(); } @@ -436,7 +436,7 @@ void Being::setSubtype(const BeingTypeId subtype, setName(mInfo->getName()); setupSpriteDisplay(mInfo->getDisplay(), ForceDisplay_false, - 0, + DisplayType::Item, mInfo->getColor(fromInt(mLook, ItemColor))); mYDiff = mInfo->getSortOffsetY(); } @@ -448,7 +448,7 @@ void Being::setSubtype(const BeingTypeId subtype, setName(mInfo->getName()); setupSpriteDisplay(mInfo->getDisplay(), ForceDisplay_false, - 0, + DisplayType::Item, mInfo->getColor(fromInt(mLook, ItemColor))); mYDiff = mInfo->getSortOffsetY(); } @@ -459,7 +459,7 @@ void Being::setSubtype(const BeingTypeId subtype, { setupSpriteDisplay(mInfo->getDisplay(), ForceDisplay_false, - 0, + DisplayType::Item, std::string()); mYDiff = mInfo->getSortOffsetY(); } @@ -470,7 +470,7 @@ void Being::setSubtype(const BeingTypeId subtype, { setupSpriteDisplay(mInfo->getDisplay(), ForceDisplay_false, - 0, + DisplayType::Item, std::string()); } break; diff --git a/src/being/flooritem.cpp b/src/being/flooritem.cpp index 545bae892..a69b8af0e 100644 --- a/src/being/flooritem.cpp +++ b/src/being/flooritem.cpp @@ -120,7 +120,7 @@ void FloorItem::postInit(Map *const map, int subX, int subY) mCursor = info.getPickupCursor(); setupSpriteDisplay(info.getDisplay(), ForceDisplay_true, - 1, + DisplayType::Floor, info.getDyeIconColorsString(mColor)); } |