From 129f749d057e3b96161630934da7b2d89dec3c71 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 18 Apr 2015 00:00:46 +0300 Subject: Add eathena defines into being. --- src/being/being.cpp | 26 ++++++++++++++++++++++++++ src/being/being.h | 30 ++++++++++++++++++------------ src/gui/popups/beingpopup.cpp | 4 ++++ src/gui/popups/popupmenu.cpp | 8 +++++++- src/gui/popups/popupmenu.h | 2 ++ 5 files changed, 57 insertions(+), 13 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 mPets; Being *mOwner; Particle *mSpecialParticle; +#ifdef EATHENA_SUPPORT ChatObject *mChat; HorseInfo *mHorseInfo; +#endif AnimatedSprite *mHorseSprite; int mX; // position in tiles diff --git a/src/gui/popups/beingpopup.cpp b/src/gui/popups/beingpopup.cpp index f0a8868f4..0592189aa 100644 --- a/src/gui/popups/beingpopup.cpp +++ b/src/gui/popups/beingpopup.cpp @@ -251,6 +251,7 @@ void BeingPopup::show(const int x, const int y, Being *const b) label3 = nullptr; } +#ifdef EATHENA_SUPPORT if (!b->getBuyBoard().empty()) { // TRANSLATORS: being popup label @@ -259,6 +260,7 @@ void BeingPopup::show(const int x, const int y, Being *const b) label4->adjustSize(); } else +#endif { label7 = label6; label6 = label5; @@ -266,6 +268,7 @@ void BeingPopup::show(const int x, const int y, Being *const b) label4 = nullptr; } +#ifdef EATHENA_SUPPORT if (!b->getSellBoard().empty()) { // TRANSLATORS: being popup label @@ -274,6 +277,7 @@ void BeingPopup::show(const int x, const int y, Being *const b) label5->adjustSize(); } else +#endif { label7 = label6; label6 = label5; diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index b16dd2ff4..b81ab29dd 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -234,7 +234,9 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being) mBrowserBox->addRow("/navigateto 'NAME'", _("Move")); addPlayerMisc(); addBuySell(being); +#ifdef EATHENA_SUPPORT addChat(being); +#endif break; } @@ -266,7 +268,9 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being) // TRANSLATORS: popup menu item // TRANSLATORS: add comment to npc mBrowserBox->addRow("addcomment", _("Add comment")); +#ifdef EATHENA_SUPPORT addChat(being); +#endif break; case ActorType::Monster: @@ -1407,13 +1411,13 @@ void PopupMenu::handleLink(const std::string &link, if (Widget::widgetExists(mWindow)) mWindow->setSticky(true); } +#ifdef EATHENA_SUPPORT else if (link == "join chat" && being) { const ChatObject *const chat = being->getChat(); if (chat) chatHandler->joinChat(chat, ""); } -#ifdef EATHENA_SUPPORT else if (link == "fire mercenary") { mercenaryHandler->fire(); @@ -2443,6 +2447,7 @@ void PopupMenu::addParty(const std::string &nick) } } +#ifdef EATHENA_SUPPORT void PopupMenu::addChat(const Being *const being) { if (!being) @@ -2457,6 +2462,7 @@ void PopupMenu::addChat(const Being *const being) mBrowserBox->addRow("##3---"); } } +#endif void PopupMenu::addPlayerMisc() { diff --git a/src/gui/popups/popupmenu.h b/src/gui/popups/popupmenu.h index d523307bf..5d6420662 100644 --- a/src/gui/popups/popupmenu.h +++ b/src/gui/popups/popupmenu.h @@ -187,7 +187,9 @@ class PopupMenu final : public Popup, public LinkHandler void addWindowMenu(Window *const window); +#ifdef EATHENA_SUPPORT void addChat(const Being *const being); +#endif void showGMPopup(); -- cgit v1.2.3-60-g2f50