summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-23 21:03:27 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-23 21:03:27 +0300
commit4b807a6184b3fcd9ba3df5d96f199917d88adc82 (patch)
treea62e22d2b53476f4fbe54040f262a86746e393b6
parent4a0aa65d1b215f8f51c6ff5a0a048f9898be6cd0 (diff)
downloadmanaplus-4b807a6184b3fcd9ba3df5d96f199917d88adc82.tar.gz
manaplus-4b807a6184b3fcd9ba3df5d96f199917d88adc82.tar.bz2
manaplus-4b807a6184b3fcd9ba3df5d96f199917d88adc82.tar.xz
manaplus-4b807a6184b3fcd9ba3df5d96f199917d88adc82.zip
Add status effect id type from int to int32_t.
-rw-r--r--src/being/actorsprite.cpp20
-rw-r--r--src/being/actorsprite.h15
-rw-r--r--src/being/localplayer.cpp2
-rw-r--r--src/being/localplayer.h4
4 files changed, 23 insertions, 18 deletions
diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp
index 5ada5bec9..7004743c1 100644
--- a/src/being/actorsprite.cpp
+++ b/src/being/actorsprite.cpp
@@ -114,7 +114,7 @@ void ActorSprite::logic()
if (mMustResetParticles)
{
mMustResetParticles = false;
- FOR_EACH (std::set<int>::const_iterator, it, mStatusEffects)
+ FOR_EACH (std::set<int32_t>::const_iterator, it, mStatusEffects)
{
const StatusEffect *const effect
= StatusEffectDB::getStatusEffect(*it, Enable_true);
@@ -173,7 +173,8 @@ struct EffectDescription final
std::string mSFXEffect;
};
-void ActorSprite::setStatusEffect(const int index, const Enable active)
+void ActorSprite::setStatusEffect(const int32_t index,
+ const Enable active)
{
const Enable wasActive = fromBool(
mStatusEffects.find(index) != mStatusEffects.end(), Enable);
@@ -194,7 +195,7 @@ void ActorSprite::setStatusEffectBlock(const int offset,
for (unsigned i = 0; i < STATUS_EFFECTS; i++)
{
const bool val = (newEffects & (1 << i)) > 0;
- const int index = StatusEffectDB::blockIdToId(
+ const int32_t index = StatusEffectDB::blockIdToId(
offset + i); // block-id (offset + i) to id (index)
if (index != -1)
@@ -220,8 +221,8 @@ static void applyEffectByOption(ActorSprite *const actor,
{
FOR_EACH (OptionsMapCIter, it, options)
{
- const int opt = (*it).first;
- const int id = (*it).second;
+ const uint32_t opt = (*it).first;
+ const int32_t id = (*it).second;
const Enable enable = (opt & option) != 0 ? Enable_true : Enable_false;
option |= opt;
option ^= opt;
@@ -247,7 +248,7 @@ static void applyEffectByOption1(ActorSprite *const actor,
FOR_EACH (OptionsMapCIter, it, options)
{
const uint32_t opt = (*it).first;
- const uint32_t id = (*it).second;
+ const int32_t id = (*it).second;
if (opt == option)
{
actor->setStatusEffect(id, Enable_true);
@@ -338,7 +339,8 @@ void ActorSprite::setStatusEffectOpiton0(const uint32_t option)
}
}
-void ActorSprite::updateStatusEffect(const int index, const Enable newStatus)
+void ActorSprite::updateStatusEffect(const int32_t index,
+ const Enable newStatus)
{
StatusEffect *const effect = StatusEffectDB::getStatusEffect(
index, newStatus);
@@ -360,7 +362,7 @@ void ActorSprite::updateStatusEffect(const int index, const Enable newStatus)
}
void ActorSprite::handleStatusEffect(const StatusEffect *const effect,
- const int effectId)
+ const int32_t effectId)
{
if (!effect)
return;
@@ -530,7 +532,7 @@ std::string ActorSprite::getStatusEffectsString() const
std::string effectsStr;
if (!mStatusEffects.empty())
{
- FOR_EACH (std::set<int>::const_iterator, it, mStatusEffects)
+ FOR_EACH (std::set<int32_t>::const_iterator, it, mStatusEffects)
{
const StatusEffect *const effect =
StatusEffectDB::getStatusEffect(
diff --git a/src/being/actorsprite.h b/src/being/actorsprite.h
index 25e7c446a..0eac9807d 100644
--- a/src/being/actorsprite.h
+++ b/src/being/actorsprite.h
@@ -107,7 +107,8 @@ class ActorSprite notfinal : public CompoundSprite, public Actor
void untarget()
{ mUsedTargetCursor = nullptr; }
- void setStatusEffect(const int index, const Enable active);
+ void setStatusEffect(const int32_t index,
+ const Enable active);
void setStatusEffectOpitons(const uint32_t option,
const uint32_t opt1,
@@ -173,7 +174,7 @@ class ActorSprite notfinal : public CompoundSprite, public Actor
bool isTrickDead() const A_WARN_UNUSED
{ return mTrickDead; }
- const std::set<int> &getStatusEffects() const A_WARN_UNUSED
+ const std::set<int32_t> &getStatusEffects() const A_WARN_UNUSED
{ return mStatusEffects; }
std::string getStatusEffectsString() const;
@@ -188,13 +189,14 @@ class ActorSprite notfinal : public CompoundSprite, public Actor
*
* These are NOT the same as the status effect indices.
*/
- void setStatusEffectBlock(const int offset, const uint16_t flags);
+ void setStatusEffectBlock(const int offset,
+ const uint16_t flags);
/**
* Notify self that a status effect has flipped.
* The new flag is passed.
*/
- virtual void updateStatusEffect(const int index,
+ virtual void updateStatusEffect(const int32_t index,
const Enable newStatus);
/**
@@ -204,7 +206,7 @@ class ActorSprite notfinal : public CompoundSprite, public Actor
* \param effectId -1 for stun, otherwise the effect index
*/
virtual void handleStatusEffect(const StatusEffect *const effect,
- const int effectId);
+ const int32_t effectId);
void setupSpriteDisplay(const SpriteDisplay &display,
const ForceDisplay forceDisplay
@@ -225,7 +227,8 @@ class ActorSprite notfinal : public CompoundSprite, public Actor
static bool loaded;
- std::set<int> mStatusEffects; /**< set of active status effects */
+ /**< set of active status effects */
+ std::set<int32_t> mStatusEffects;
ParticleVector mStatusParticleEffects;
ParticleList mChildParticleEffects;
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index ec62fe735..bd03cbf96 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -995,7 +995,7 @@ void LocalPlayer::setGotoTarget(Being *const target)
}
void LocalPlayer::handleStatusEffect(const StatusEffect *const effect,
- const int effectId)
+ const int32_t effectId)
{
Being::handleStatusEffect(effect, effectId);
diff --git a/src/being/localplayer.h b/src/being/localplayer.h
index 732c27c7f..ccecb18fb 100644
--- a/src/being/localplayer.h
+++ b/src/being/localplayer.h
@@ -427,7 +427,7 @@ class LocalPlayer final : public Being,
void updateCoords() override final;
void handleStatusEffect(const StatusEffect *const effect,
- const int effectId) override final;
+ const int32_t effectId) override final;
void startWalking(const unsigned char dir);
@@ -460,7 +460,7 @@ class LocalPlayer final : public Being,
int mLastAction; // Time stamp of the last action, -1 if none.
- std::vector<int> mStatusEffectIcons;
+ std::vector<int32_t> mStatusEffectIcons;
typedef std::pair<std::string, UserColorIdT> MessagePair;
/** Queued messages*/