summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-30 17:04:50 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-30 17:04:50 +0300
commit2a33b736dc93251bf7a72364c5f818142362a3ce (patch)
treef2739f3f5721d517149a8b00d0c88fbfe095aaea /src/being
parent2b46f2d6d7cd732f1f4f1d9e8a15a1428166a959 (diff)
downloadplus-2a33b736dc93251bf7a72364c5f818142362a3ce.tar.gz
plus-2a33b736dc93251bf7a72364c5f818142362a3ce.tar.bz2
plus-2a33b736dc93251bf7a72364c5f818142362a3ce.tar.xz
plus-2a33b736dc93251bf7a72364c5f818142362a3ce.zip
Convert Reachable enum into strong typed enum.
Diffstat (limited to 'src/being')
-rw-r--r--src/being/being.cpp3
-rw-r--r--src/being/being.h12
-rw-r--r--src/being/localplayer.cpp10
3 files changed, 13 insertions, 12 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 179e64635..ddd0e7473 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -41,7 +41,6 @@
#include "enums/being/attributes.h"
#include "enums/being/beingdirection.h"
-#include "enums/being/reachable.h"
#include "enums/net/packettypes.h"
@@ -202,7 +201,7 @@ Being::Being(const BeingId id,
mHP(0),
mMaxHP(0),
mDistance(0),
- mIsReachable(Reachable::REACH_UNKNOWN),
+ mReachable(Reachable::REACH_UNKNOWN),
mGoodStatus(-1),
mMoveTime(0),
mAttackTime(0),
diff --git a/src/being/being.h b/src/being/being.h
index ead24af3f..6e8588213 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -23,6 +23,8 @@
#ifndef BEING_BEING_H
#define BEING_BEING_H
+#include "enums/being/reachable.h"
+
#include "enums/simpletypes/move.h"
#include "resources/beinginfo.h"
@@ -556,11 +558,11 @@ class Being notfinal : public ActorSprite,
virtual int getLevel() const A_WARN_UNUSED
{ return mLevel; }
- void setIsReachable(const int n)
- { mIsReachable = n; }
+ void setReachable(const ReachableT n)
+ { mReachable = n; }
- int isReachable() const A_WARN_UNUSED
- { return mIsReachable; }
+ ReachableT getReachable() const A_WARN_UNUSED
+ { return mReachable; }
static void reReadConfig();
@@ -1058,7 +1060,7 @@ class Being notfinal : public ActorSprite,
int mHP;
int mMaxHP;
int mDistance;
- int mIsReachable; /**< 0 - unknown, 1 - reachable, 2 - not reachable*/
+ ReachableT mReachable; /**< 0 - unknown, 1 - reachable, 2 - not reachable*/
int mGoodStatus;
static int mUpdateConfigTime;
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 6c8bd5ea6..b4f19ef00 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -1376,14 +1376,14 @@ bool LocalPlayer::isReachable(Being *const being,
if (!being || !mMap)
return false;
- if (being->isReachable() == Reachable::REACH_NO)
+ if (being->getReachable() == Reachable::REACH_NO)
return false;
if (being->getTileX() == mX
&& being->getTileY() == mY)
{
being->setDistance(0);
- being->setIsReachable(Reachable::REACH_YES);
+ being->setReachable(Reachable::REACH_YES);
return true;
}
else if (being->getTileX() - 1 <= mX
@@ -1392,7 +1392,7 @@ bool LocalPlayer::isReachable(Being *const being,
&& being->getTileY() + 1 >= mY)
{
being->setDistance(1);
- being->setIsReachable(Reachable::REACH_YES);
+ being->setReachable(Reachable::REACH_YES);
return true;
}
@@ -1406,12 +1406,12 @@ bool LocalPlayer::isReachable(Being *const being,
being->setDistance(static_cast<int>(debugPath.size()));
if (!debugPath.empty())
{
- being->setIsReachable(Reachable::REACH_YES);
+ being->setReachable(Reachable::REACH_YES);
return true;
}
else
{
- being->setIsReachable(Reachable::REACH_NO);
+ being->setReachable(Reachable::REACH_NO);
return false;
}
}