From 8b2464a723f7039a3efbc0c7d2e883729b3fa7dd Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 3 Aug 2014 00:46:38 +0300 Subject: Fix some casts. --- src/being/actorsprite.cpp | 2 +- src/being/being.cpp | 15 ++++++++------- src/being/being.h | 5 +++-- 3 files changed, 12 insertions(+), 10 deletions(-) (limited to 'src/being') diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp index c26d33d7e..24c8779c0 100644 --- a/src/being/actorsprite.cpp +++ b/src/being/actorsprite.cpp @@ -157,7 +157,7 @@ void ActorSprite::setTargetType(const TargetCursorType::Type type) } else { - const TargetCursorSize::Size sz = getTargetCursorSize(); + const size_t sz = static_cast(getTargetCursorSize()); mUsedTargetCursor = targetCursor[static_cast(type)][sz]; if (mUsedTargetCursor) { diff --git a/src/being/being.cpp b/src/being/being.cpp index 4d45d19bd..f45fa4ec8 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -718,7 +718,7 @@ int Being::getHitEffect(const Being *const attacker, return hitEffectId; } -int Being::getDefaultEffectId(const int type) +int Being::getDefaultEffectId(const AttackType &type) { if (type == MISS) return paths.getIntValue("missEffectId"); @@ -2638,7 +2638,7 @@ void Being::recalcSpritesOrder() { // slot unknown. Search for real slot, this can be slow FOR_EACH (IntMapCIter, repIt, itemReplacer) { - for (unsigned slot2 = 0; slot2 < sz; slot2 ++) + for (unsigned int slot2 = 0; slot2 < sz; slot2 ++) { if (mSpriteIDs[slot2] == repIt->first) { @@ -2723,7 +2723,7 @@ void Being::recalcSpritesOrder() cnt ++; // logger->log("iteration"); - for (unsigned slot0 = 0; slot0 < sz; slot0 ++) + for (unsigned int slot0 = 0; slot0 < sz; slot0 ++) { const int slot = searchSlotValue(slotRemap, slot0); const int val = slotRemap.at(slot); @@ -2788,7 +2788,7 @@ void Being::recalcSpritesOrder() } // logger->log("after remap"); - for (unsigned slot = 0; slot < sz; slot ++) + for (unsigned int slot = 0; slot < sz; slot ++) { mSpriteRemap[slot] = slotRemap[slot]; if (mSpriteHide[slot] == 0) @@ -2899,7 +2899,8 @@ void Being::updateComment() mComment = loadComment(mName, mType); } -std::string Being::loadComment(const std::string &name, const int type) +std::string Being::loadComment(const std::string &name, + const ActorType::Type &type) { std::string str; switch (type) @@ -3056,7 +3057,7 @@ Gender::Type Being::intToGender(const uint8_t sex) int Being::getSpriteID(const int slot) const { - if (slot < 0 || static_cast(slot) >= mSpriteIDs.size()) + if (slot < 0 || static_cast(slot) >= mSpriteIDs.size()) return -1; return mSpriteIDs[slot]; @@ -3064,7 +3065,7 @@ int Being::getSpriteID(const int slot) const unsigned char Being::getSpriteColor(const int slot) const { - if (slot < 0 || static_cast(slot) >= mSpriteColorsIds.size()) + if (slot < 0 || static_cast(slot) >= mSpriteColorsIds.size()) return 1; return mSpriteColorsIds[slot]; diff --git a/src/being/being.h b/src/being/being.h index fc7f27bb7..929ebf8d9 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -756,7 +756,8 @@ class Being notfinal : public ActorSprite, static void clearCache(); static std::string loadComment(const std::string &name, - const int type) A_WARN_UNUSED; + const ActorType::Type &type) + A_WARN_UNUSED; static void saveComment(const std::string &restrict name, const std::string &restrict comment, @@ -908,7 +909,7 @@ class Being notfinal : public ActorSprite, void createSpeechBubble(); - static int getDefaultEffectId(const int type); + static int getDefaultEffectId(const AttackType &type); BeingInfo *mInfo; AnimatedSprite *mEmotionSprite; -- cgit v1.2.3-70-g09d2