From 448ff09baf47387c9cfb6919028b1d4bbe2c8f0b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 29 Jul 2016 03:12:26 +0300 Subject: Add some missing tmwa defines. --- src/actions/actions.cpp | 4 ++++ src/actormanager.cpp | 4 ++++ src/actormanager.h | 2 ++ src/being/being.cpp | 22 ++++++++++++++++++++++ src/being/being.h | 6 ++++-- src/being/localplayer.cpp | 2 ++ src/being/localplayer.h | 10 ++++++++-- src/enums/being/actortype.h | 2 ++ src/game.cpp | 2 +- src/gui/popups/popupmenu.cpp | 4 ++++ src/gui/viewport.cpp | 8 ++++++-- src/gui/windows/minimap.cpp | 2 ++ src/gui/windows/serverdialog.cpp | 2 -- src/gui/windows/textcommandeditor.cpp | 2 ++ src/net/ea/playerrecv.cpp | 2 ++ src/net/eathena/beingrecv.cpp | 1 - 16 files changed, 65 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index eb652d9b7..cf82dc8e6 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -583,6 +583,7 @@ impHandler0(healmd) impHandler0(itenplz) { +#ifdef TMWA_SUPPORT if (Net::getNetworkType() != ServerType::TMWATHENA) return false; if (actorManager) @@ -595,6 +596,7 @@ impHandler0(itenplz) } return true; } +#endif return false; } @@ -610,6 +612,7 @@ impHandler0(setHome) impHandler0(magicAttack) { +#ifdef TMWA_SUPPORT if (Net::getNetworkType() != ServerType::TMWATHENA) return false; if (localPlayer) @@ -617,6 +620,7 @@ impHandler0(magicAttack) localPlayer->magicAttack(); return true; } +#endif return false; } diff --git a/src/actormanager.cpp b/src/actormanager.cpp index e2bb85eb5..ba6db8c63 100644 --- a/src/actormanager.cpp +++ b/src/actormanager.cpp @@ -587,7 +587,9 @@ void ActorManager::findBeingsByPixel(std::vector &beings, case ActorType::Player: case ActorType::Npc: case ActorType::Monster: +#ifdef TMWA_SUPPORT case ActorType::LocalPet: +#endif case ActorType::Pet: case ActorType::Mercenary: case ActorType::Homunculus: @@ -1505,6 +1507,7 @@ Being* ActorManager::findMostDamagedPlayer(const int maxTileDist) const return target; } +#ifdef TMWA_SUPPORT void ActorManager::itenplz() const { if (Net::getNetworkType() != ServerType::TMWATHENA) @@ -1522,6 +1525,7 @@ void ActorManager::itenplz() const chatWindow->localChatInput(mSpellItenplz); } +#endif bool ActorManager::hasActorSprite(const ActorSprite *const actor) const { diff --git a/src/actormanager.h b/src/actormanager.h index 89d0133c3..12ac788a4 100644 --- a/src/actormanager.h +++ b/src/actormanager.h @@ -231,7 +231,9 @@ class ActorManager final: public ConfigListener void heal(const Being *const target) const; +#ifdef TMWA_SUPPORT void itenplz() const; +#endif /** * Returns the whole list of beings. diff --git a/src/being/being.cpp b/src/being/being.cpp index 285ed8ca0..d762dee24 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -328,8 +328,10 @@ Being::~Being() if (mOwner) { +#ifdef TMWA_SUPPORT if (mType == ActorType::LocalPet) mOwner->unassignPet(this); +#endif mOwner = nullptr; } @@ -441,6 +443,7 @@ void Being::setSubtype(const BeingTypeId subtype, if (mInfo) setupSpriteDisplay(mInfo->getDisplay(), ForceDisplay_false); break; +#ifdef TMWA_SUPPORT case ActorType::LocalPet: mInfo = PETDB::get(fromInt(mId, BeingTypeId)); if (mInfo) @@ -462,6 +465,7 @@ void Being::setSubtype(const BeingTypeId subtype, } } break; +#endif case ActorType::Player: { int id = -100 - toInt(subtype, int); @@ -2553,12 +2557,14 @@ void Being::setSpriteId(const unsigned int slot, int startTime = 0; AnimatedSprite *restrict equipmentSprite = nullptr; +#ifdef TMWA_SUPPORT if (mType == ActorType::Player) { const BeingId pet = fromInt(info.getPet(), BeingId); if (pet != BeingId_zero) addPet(pet); } +#endif if (!filename.empty()) { @@ -2685,12 +2691,14 @@ void Being::setSpriteColor(const unsigned int slot, int startTime = 0; AnimatedSprite *restrict equipmentSprite = nullptr; +#ifdef TMWA_SUPPORT if (mType == ActorType::Player) { const BeingId pet = fromInt(info.getPet(), BeingId); if (pet != BeingId_zero) addPet(pet); } +#endif if (!filename.empty()) { @@ -2781,12 +2789,14 @@ void Being::setSpriteColorId(const unsigned int slot, int startTime = 0; AnimatedSprite *restrict equipmentSprite = nullptr; +#ifdef TMWA_SUPPORT if (mType == ActorType::Player) { const BeingId pet = fromInt(info.getPet(), BeingId); if (pet != BeingId_zero) addPet(pet); } +#endif if (!filename.empty()) { @@ -2879,12 +2889,14 @@ void Being::setSpriteCards(const unsigned int slot, int startTime = 0; AnimatedSprite *restrict equipmentSprite = nullptr; +#ifdef TMWA_SUPPORT if (mType == ActorType::Player) { const BeingId pet = fromInt(info.getPet(), BeingId); if (pet != BeingId_zero) addPet(pet); } +#endif if (!cards.isEmpty()) colorId = ItemColorManager::getColorFromCards(cards); @@ -3618,7 +3630,9 @@ void Being::draw(Graphics *restrict const graphics, break; case ActorType::Npc: case ActorType::FloorItem: +#ifdef TMWA_SUPPORT case ActorType::LocalPet: +#endif case ActorType::Avatar: default: drawOther(graphics, @@ -4412,7 +4426,9 @@ std::string Being::loadComment(const std::string &restrict name, case ActorType::Monster: case ActorType::FloorItem: case ActorType::Portal: +#ifdef TMWA_SUPPORT case ActorType::LocalPet: +#endif case ActorType::Avatar: case ActorType::Mercenary: case ActorType::Homunculus: @@ -4449,7 +4465,9 @@ void Being::saveComment(const std::string &restrict name, case ActorType::Monster: case ActorType::FloorItem: case ActorType::Portal: +#ifdef TMWA_SUPPORT case ActorType::LocalPet: +#endif case ActorType::Avatar: case ActorType::Unknown: case ActorType::Pet: @@ -4655,6 +4673,7 @@ void Being::addEffect(const std::string &restrict name) restrict2 paths.getStringValue("sprites") + name); } +#ifdef TMWA_SUPPORT void Being::addPet(const BeingId id) restrict2 { if (!actorManager || !config.getBoolValue("usepets")) @@ -4679,6 +4698,7 @@ void Being::addPet(const BeingId id) restrict2 being->setTileCoords(dstX, dstY); } } +#endif Being *Being::findChildPet(const BeingId id) restrict2 { @@ -4728,6 +4748,7 @@ void Being::removeAllPets() restrict2 mPets.clear(); } +#ifdef TMWA_SUPPORT void Being::updatePets() restrict2 { removeAllPets(); @@ -4742,6 +4763,7 @@ void Being::updatePets() restrict2 addPet(pet); } } +#endif void Being::unassignPet(const Being *restrict const pet1) restrict2 { diff --git a/src/being/being.h b/src/being/being.h index a224403c7..6b805a3b6 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -889,11 +889,13 @@ class Being notfinal : public ActorSprite, void addEffect(const std::string &restrict name) restrict2; +#ifdef TMWA_SUPPORT void addPet(const BeingId id) restrict2; - void removePet(const BeingId id) restrict2; - void updatePets() restrict2; +#endif + + void removePet(const BeingId id) restrict2; void fixPetSpawnPos(int &restrict dstX, int &restrict dstY) const restrict2; diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 62f30a015..af020d7ea 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -1638,6 +1638,7 @@ void LocalPlayer::specialMove(const unsigned char direction) } } +#ifdef TMWA_SUPPORT void LocalPlayer::magicAttack() const { if (Net::getNetworkType() != ServerType::TMWATHENA) @@ -1693,6 +1694,7 @@ void LocalPlayer::tryMagic(const std::string &spell, const int baseMagic, } } } +#endif void LocalPlayer::loadHomes() { diff --git a/src/being/localplayer.h b/src/being/localplayer.h index 50ef31052..cfbdf4285 100644 --- a/src/being/localplayer.h +++ b/src/being/localplayer.h @@ -204,7 +204,9 @@ class LocalPlayer final : public Being, void tryPingRequest(); +#ifdef TMWA_SUPPORT void magicAttack() const; +#endif void specialMove(const unsigned char direction); @@ -441,8 +443,12 @@ class LocalPlayer final : public Being, void changeEquipmentBeforeAttack(const Being *const target) const; - static void tryMagic(const std::string &spell, const int baseMagic, - const int schoolMagic, const int mana); +#ifdef TMWA_SUPPORT + static void tryMagic(const std::string &spell, + const int baseMagic, + const int schoolMagic, + const int mana); +#endif void loadHomes(); diff --git a/src/enums/being/actortype.h b/src/enums/being/actortype.h index c742255d9..68e046690 100644 --- a/src/enums/being/actortype.h +++ b/src/enums/being/actortype.h @@ -32,7 +32,9 @@ enumStart(ActorType) Monster, FloorItem, Portal, +#ifdef TMWA_SUPPORT LocalPet, +#endif Avatar, Pet, Mercenary, diff --git a/src/game.cpp b/src/game.cpp index 1b3cbc8e4..27f4a5e5d 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -433,10 +433,10 @@ Game::Game() : #ifdef TMWA_SUPPORT if (guildManager && GuildManager::getEnableGuildBot()) guildManager->requestGuildInfo(); -#endif if (localPlayer) localPlayer->updatePets(); +#endif settings.disableLoggingInGame = config.getBoolValue( "disableLoggingInGame"); diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index e74873a10..2e153b0a8 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -430,7 +430,9 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being) case ActorType::Unknown: case ActorType::FloorItem: case ActorType::Portal: +#ifdef TMWA_SUPPORT case ActorType::LocalPet: +#endif default: break; } @@ -3194,7 +3196,9 @@ void PopupMenu::showGMPopup(const std::string &name) showItemGMCommands(); break; case ActorType::Portal: +#ifdef TMWA_SUPPORT case ActorType::LocalPet: +#endif case ActorType::Avatar: break; } diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index a543f53bd..ab3d31588 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -835,8 +835,10 @@ void Viewport::mouseMoved(MouseEvent &event) || type == ActorType::Npc || type == ActorType::Homunculus || type == ActorType::Mercenary - || type == ActorType::Pet - || type == ActorType::LocalPet)) +#ifdef TMWA_SUPPORT + || type == ActorType::LocalPet +#endif + || type == ActorType::Pet)) { popupManager->hideTextPopup(); if (mShowBeingPopup && beingPopup) @@ -892,7 +894,9 @@ void Viewport::mouseMoved(MouseEvent &event) case ActorType::Npc: case ActorType::Monster: case ActorType::Portal: +#ifdef TMWA_SUPPORT case ActorType::LocalPet: +#endif case ActorType::Pet: case ActorType::Mercenary: case ActorType::Homunculus: diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp index e149f06e8..606b1ce7e 100644 --- a/src/gui/windows/minimap.cpp +++ b/src/gui/windows/minimap.cpp @@ -351,7 +351,9 @@ void Minimap::draw2(Graphics *const graphics) type = UserColorId::PORTAL_HIGHLIGHT; break; +#ifdef TMWA_SUPPORT case ActorType::LocalPet: +#endif case ActorType::Pet: type = UserColorId::PET; break; diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index 6d9992cab..5299d4fd1 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -80,9 +80,7 @@ static uint16_t defaultPortForServerType(const ServerTypeT type) case ServerType::EVOL2: return 6900; case ServerType::UNKNOWN: -#ifdef TMWA_SUPPORT case ServerType::TMWATHENA: -#endif return 6901; } } diff --git a/src/gui/windows/textcommandeditor.cpp b/src/gui/windows/textcommandeditor.cpp index 5c59cd389..2e31ca80f 100644 --- a/src/gui/windows/textcommandeditor.cpp +++ b/src/gui/windows/textcommandeditor.cpp @@ -42,7 +42,9 @@ #include "debug.h" +#ifdef TMWA_SUPPORT const unsigned int MAGIC_START_ID = 340; +#endif TextCommandEditor::TextCommandEditor(TextCommand *const command) : // TRANSLATORS: command editor name diff --git a/src/net/ea/playerrecv.cpp b/src/net/ea/playerrecv.cpp index 7a3b448f7..c8ebd6651 100644 --- a/src/net/ea/playerrecv.cpp +++ b/src/net/ea/playerrecv.cpp @@ -120,7 +120,9 @@ void PlayerRecv::processPlayerWarp(Net::MessageIn &msg) localPlayer->setAction(BeingAction::STAND, 0); localPlayer->setTileCoords(x, y); +#ifdef TMWA_SUPPORT localPlayer->updatePets(); +#endif localPlayer->navigateClean(); localPlayer->reset(); } diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp index 6fbc28097..b918ae108 100644 --- a/src/net/eathena/beingrecv.cpp +++ b/src/net/eathena/beingrecv.cpp @@ -1735,7 +1735,6 @@ void BeingRecv::processBeingSlide(Net::MessageIn &msg) dstBeing->setAction(BeingAction::STAND, 0); dstBeing->setTileCoords(x, y); - dstBeing->updatePets(); } void BeingRecv::processStarsKill(Net::MessageIn &msg) -- cgit v1.2.3-70-g09d2