summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-04-18 00:00:46 +0300
committerAndrei Karas <akaras@inbox.ru>2015-04-18 00:00:46 +0300
commit129f749d057e3b96161630934da7b2d89dec3c71 (patch)
tree1a11c98aaf08a46d544e9b3acf3910a560546c8b /src/being
parent39ab9ebf7464f77f079a8edecd3f43870245b8ee (diff)
downloadplus-129f749d057e3b96161630934da7b2d89dec3c71.tar.gz
plus-129f749d057e3b96161630934da7b2d89dec3c71.tar.bz2
plus-129f749d057e3b96161630934da7b2d89dec3c71.tar.xz
plus-129f749d057e3b96161630934da7b2d89dec3c71.zip
Add eathena defines into being.
Diffstat (limited to 'src/being')
-rw-r--r--src/being/being.cpp26
-rw-r--r--src/being/being.h30
2 files changed, 44 insertions, 12 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 4109e01a4..fefdbf256 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -178,14 +178,18 @@ Being::Being(const int id,
mSpriteHide(new int[20]),
mSpriteDraw(new int[20]),
mComment(),
+#ifdef EATHENA_SUPPORT
mBuyBoard(),
mSellBoard(),
+#endif
mPets(),
mOwner(nullptr),
mSpecialParticle(nullptr),
+#ifdef EATHENA_SUPPORT
mChat(nullptr),
mHorseInfo(nullptr),
mHorseSprite(nullptr),
+#endif
mX(0),
mY(0),
mSortOffsetY(0),
@@ -283,7 +287,9 @@ Being::~Being()
delete2(mText);
delete2(mEmotionSprite);
delete2(mAnimationEffect);
+#ifdef EATHENA_SUPPORT
delete2(mChat);
+#endif
if (mOwner)
{
@@ -1345,8 +1351,10 @@ void Being::setAction(const BeingAction::Action &action, const int attackId)
mEmotionSprite->play(currentAction);
if (mAnimationEffect)
mAnimationEffect->play(currentAction);
+#ifdef EATHENA_SUPPORT
if (mHorseSprite)
mHorseSprite->play(currentAction);
+#endif
mAction = action;
}
@@ -1406,8 +1414,10 @@ void Being::setDirection(const uint8_t direction)
mEmotionSprite->setSpriteDirection(dir);
if (mAnimationEffect)
mAnimationEffect->setSpriteDirection(dir);
+#ifdef EATHENA_SUPPORT
if (mHorseSprite)
mHorseSprite->setSpriteDirection(dir);
+#endif
recalcSpritesOrder();
}
@@ -1497,8 +1507,10 @@ void Being::logic()
const int time = tick_time * MILLISECONDS_IN_A_TICK;
if (mEmotionSprite)
mEmotionSprite->update(time);
+#ifdef EATHENA_SUPPORT
if (mHorseSprite)
mHorseSprite->update(time);
+#endif
if (mAnimationEffect)
{
@@ -2462,6 +2474,7 @@ void Being::draw(Graphics *const graphics,
{
const int px = getActorX() + offsetX;
const int py = getActorY() + offsetY;
+#ifdef EATHENA_SUPPORT
if (mHorseInfo)
{
AnimatedSprite *const sprite = mHorseInfo->sprite;
@@ -2472,6 +2485,7 @@ void Being::draw(Graphics *const graphics,
py + mHorseInfo->offsetY);
}
}
+#endif
ActorSprite::draw1(graphics, px, py);
drawSpriteAt(graphics, px, py);
}
@@ -3596,6 +3610,7 @@ void Being::recreateItemParticles()
}
}
+#ifdef EATHENA_SUPPORT
void Being::setChat(ChatObject *const obj)
{
delete mChat;
@@ -3615,6 +3630,7 @@ void Being::setBuyBoard(const std::string &text)
mBuyBoard = text;
updateName();
}
+#endif
void Being::enableShop(const bool b)
{
@@ -3624,14 +3640,23 @@ void Being::enableShop(const bool b)
bool Being::isBuyShopEnabled() const
{
+#ifdef EATHENA_SUPPORT
return mShop && (!serverFeatures->haveVending() || !mBuyBoard.empty());
+#else
+ return mShop;
+#endif
}
bool Being::isSellShopEnabled() const
{
+#ifdef EATHENA_SUPPORT
return mShop && (!serverFeatures->haveVending() || !mSellBoard.empty());
+#else
+ return mShop;
+#endif
}
+#ifdef EATHENA_SUPPORT
void Being::setRiding(const bool b)
{
if (b == mRiding)
@@ -3649,3 +3674,4 @@ void Being::setRiding(const bool b)
mHorseSprite = nullptr;
}
}
+#endif
diff --git a/src/being/being.h b/src/being/being.h
index 6364f8aed..9f9f3992d 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -891,11 +891,25 @@ class Being notfinal : public ActorSprite,
virtual int getLastAttackY() const
{ return mLastAttackY; }
+#ifdef EATHENA_SUPPORT
void setChat(ChatObject *const obj);
ChatObject *getChat() const
{ return mChat; }
+ void setRiding(const bool b) override final;
+
+ void setSellBoard(const std::string &text);
+
+ std::string getSellBoard() const A_WARN_UNUSED
+ { return mSellBoard; }
+
+ void setBuyBoard(const std::string &text);
+
+ std::string getBuyBoard() const A_WARN_UNUSED
+ { return mBuyBoard; }
+#endif
+
void setKarma(const int karma)
{ mKarma = karma; }
@@ -920,18 +934,6 @@ class Being notfinal : public ActorSprite,
void setAreaSize(const int areaSize)
{ mAreaSize = areaSize; }
- void setSellBoard(const std::string &text);
-
- std::string getSellBoard() const A_WARN_UNUSED
- { return mSellBoard; }
-
- void setBuyBoard(const std::string &text);
-
- std::string getBuyBoard() const A_WARN_UNUSED
- { return mBuyBoard; }
-
- void setRiding(const bool b) override final;
-
protected:
/**
* Updates name's location.
@@ -1050,13 +1052,17 @@ class Being notfinal : public ActorSprite,
int *mSpriteHide;
int *mSpriteDraw;
std::string mComment;
+#ifdef EATHENA_SUPPORT
std::string mBuyBoard;
std::string mSellBoard;
+#endif
std::vector<Being*> mPets;
Being *mOwner;
Particle *mSpecialParticle;
+#ifdef EATHENA_SUPPORT
ChatObject *mChat;
HorseInfo *mHorseInfo;
+#endif
AnimatedSprite *mHorseSprite;
int mX; // position in tiles