From 42701a1ac7b553f445b68c23fd115cc522d1b679 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 25 Sep 2014 23:04:34 +0300 Subject: Add simple follow logic for mercenary and homunculus. --- src/being/localplayer.cpp | 2 ++ src/being/playerinfo.cpp | 10 ++++++++++ src/being/playerinfo.h | 2 ++ 3 files changed, 14 insertions(+) (limited to 'src') diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 30e323d7e..a160896fb 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -460,6 +460,8 @@ void LocalPlayer::nextTile(unsigned char dir A_UNUSED = 0) { Being::nextTile(); } + + PlayerInfo::updateMoveAI(); } bool LocalPlayer::pickUp(FloorItem *const item) diff --git a/src/being/playerinfo.cpp b/src/being/playerinfo.cpp index 428878af9..d2749a9b1 100644 --- a/src/being/playerinfo.cpp +++ b/src/being/playerinfo.cpp @@ -39,7 +39,9 @@ #include "resources/iteminfo.h" +#include "net/homunculushandler.h" #include "net/inventoryhandler.h" +#include "net/mercenaryhandler.h" #include "net/net.h" #include "net/playerhandler.h" @@ -543,4 +545,12 @@ int getMercenaryId() return mMercenary ? mMercenary->id : 0; } +void updateMoveAI() +{ + if (mMercenary) + mercenaryHandler->moveToMaster(); + if (mHomunculus) + homunculusHandler->moveToMaster(); +} + } // namespace PlayerInfo diff --git a/src/being/playerinfo.h b/src/being/playerinfo.h index 6082aa740..784a3b8ea 100644 --- a/src/being/playerinfo.h +++ b/src/being/playerinfo.h @@ -260,6 +260,8 @@ namespace PlayerInfo int getHomunculusId(); int getMercenaryId(); + + void updateMoveAI(); } // namespace PlayerInfo #endif // BEING_PLAYERINFO_H -- cgit v1.2.3-60-g2f50