summaryrefslogtreecommitdiff
path: root/src/being/being.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/being/being.cpp')
-rw-r--r--src/being/being.cpp90
1 files changed, 31 insertions, 59 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 487749a0d..1523c10a0 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -1032,45 +1032,31 @@ void Being::fireMissile(Being *const victim, const std::string &particle) const
std::string Being::getSitAction() const
{
- if (serverVersion < 0)
+ if (mMap)
{
- return SpriteAction::SIT;
- }
- else
- {
- if (mMap)
- {
- const unsigned char mask = mMap->getBlockMask(mX, mY);
- if (mask & BlockMask::GROUNDTOP)
- return SpriteAction::SITTOP;
- else if (mask & BlockMask::AIR)
- return SpriteAction::SITSKY;
- else if (mask & BlockMask::WATER)
- return SpriteAction::SITWATER;
- }
- return SpriteAction::SIT;
+ const unsigned char mask = mMap->getBlockMask(mX, mY);
+ if (mask & BlockMask::GROUNDTOP)
+ return SpriteAction::SITTOP;
+ else if (mask & BlockMask::AIR)
+ return SpriteAction::SITSKY;
+ else if (mask & BlockMask::WATER)
+ return SpriteAction::SITWATER;
}
+ return SpriteAction::SIT;
}
std::string Being::getMoveAction() const
{
- if (serverVersion < 0)
- {
- return SpriteAction::MOVE;
- }
- else
+ if (mMap)
{
- if (mMap)
- {
- const unsigned char mask = mMap->getBlockMask(mX, mY);
- if (mask & BlockMask::AIR)
- return SpriteAction::FLY;
- else if (mask & BlockMask::WATER)
- return SpriteAction::SWIM;
- }
- return SpriteAction::MOVE;
+ const unsigned char mask = mMap->getBlockMask(mX, mY);
+ if (mask & BlockMask::AIR)
+ return SpriteAction::FLY;
+ else if (mask & BlockMask::WATER)
+ return SpriteAction::SWIM;
}
+ return SpriteAction::MOVE;
}
std::string Being::getWeaponAttackAction(const ItemInfo *const weapon) const
@@ -1101,43 +1087,29 @@ std::string Being::getAttackAction(const Attack *const attack1) const
if (!attack1)
return SpriteAction::ATTACK;
- if (serverVersion < 0)
+ if (mMap)
{
- return attack1->mAction;
- }
- else
- {
- if (mMap)
- {
- const unsigned char mask = mMap->getBlockMask(mX, mY);
- if (mask & BlockMask::AIR)
- return attack1->mSkyAction;
- else if (mask & BlockMask::WATER)
- return attack1->mWaterAction;
- }
- return attack1->mAction;
+ const unsigned char mask = mMap->getBlockMask(mX, mY);
+ if (mask & BlockMask::AIR)
+ return attack1->mSkyAction;
+ else if (mask & BlockMask::WATER)
+ return attack1->mWaterAction;
}
+ return attack1->mAction;
}
#define getSpriteAction(func, action) \
std::string Being::get##func##Action() const \
{ \
- if (serverVersion < 0) \
- { \
- return SpriteAction::action; \
- } \
- else \
+ if (mMap) \
{ \
- if (mMap) \
- { \
- const unsigned char mask = mMap->getBlockMask(mX, mY); \
- if (mask & BlockMask::AIR) \
- return SpriteAction::action##SKY; \
- else if (mask & BlockMask::WATER) \
- return SpriteAction::action##WATER; \
- } \
- return SpriteAction::action; \
+ const unsigned char mask = mMap->getBlockMask(mX, mY); \
+ if (mask & BlockMask::AIR) \
+ return SpriteAction::action##SKY; \
+ else if (mask & BlockMask::WATER) \
+ return SpriteAction::action##WATER; \
} \
+ return SpriteAction::action; \
}
getSpriteAction(Dead, DEAD)
@@ -3028,7 +3000,7 @@ void Being::setEmote(const uint8_t emotion, const int emote_time)
void Being::updatePercentHP()
{
- if (!mMaxHP || !serverVersion)
+ if (!mMaxHP)
return;
if (mHP)
{