diff options
-rw-r--r-- | src/actions/pets.cpp | 16 | ||||
-rw-r--r-- | src/being/playerinfo.cpp | 9 | ||||
-rw-r--r-- | src/being/playerinfo.h | 2 |
3 files changed, 23 insertions, 4 deletions
diff --git a/src/actions/pets.cpp b/src/actions/pets.cpp index 925ab993f..061a7dd6d 100644 --- a/src/actions/pets.cpp +++ b/src/actions/pets.cpp @@ -27,10 +27,12 @@ #include "actions/actiondef.h" #include "being/localplayer.h" +#include "being/playerinfo.h" #include "gui/chatconsts.h" #include "net/chathandler.h" +#include "net/net.h" #include "net/pethandler.h" #include "net/serverfeatures.h" @@ -44,13 +46,19 @@ namespace Actions static const Being *getPet() { +#ifdef TMWA_SUPPORT if (!localPlayer) return nullptr; - const std::vector<Being*> &pets = localPlayer->getPets(); - if (pets.empty()) - return nullptr; - return *pets.begin(); + if (Net::getNetworkType() == ServerType::TMWATHENA) + { + const std::vector<Being*> &pets = localPlayer->getPets(); + if (pets.empty()) + return nullptr; + return *pets.begin(); + } +#endif + return PlayerInfo::getPetBeing(); } impHandler(commandEmotePet) diff --git a/src/being/playerinfo.cpp b/src/being/playerinfo.cpp index 892c5bba9..23a55f6fe 100644 --- a/src/being/playerinfo.cpp +++ b/src/being/playerinfo.cpp @@ -64,6 +64,7 @@ Equipment *mEquipment = nullptr; MercenaryInfo *mMercenary = nullptr; HomunculusInfo *mHomunculus = nullptr; PetInfo *mPet = nullptr; +Being *mPetBeing = nullptr; GuildPositionFlags::Type mGuildPositionFlags = GuildPositionFlags::None; bool mTrading = false; @@ -394,6 +395,7 @@ void deinit() { clearInventory(); delete2(mMercenary); + mPetBeing = nullptr; } void loadData() @@ -406,6 +408,7 @@ void loadData() void clear() { mData.mSkills.clear(); + mPetBeing = nullptr; } bool isTalking() @@ -505,6 +508,7 @@ void setPet(PetInfo *const info) void setPetBeing(Being *const being) { + mPetBeing = being; if (!being || !mPet) return; being->setName(mPet->name); @@ -517,6 +521,11 @@ PetInfo *getPet() return mPet; } +Being *getPetBeing() +{ + return mPetBeing; +} + void setHomunculus(HomunculusInfo *const info) { if (mHomunculus) diff --git a/src/being/playerinfo.h b/src/being/playerinfo.h index 1f91f6e3d..d8272dca4 100644 --- a/src/being/playerinfo.h +++ b/src/being/playerinfo.h @@ -251,6 +251,8 @@ namespace PlayerInfo void setPetBeing(Being *const being); + Being *getPetBeing(); + HomunculusInfo *getHomunculus(); void setHomunculus(HomunculusInfo *const info); |