From ee22da622e35166aa646f9ce486db8bed10d121e Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 28 Sep 2021 16:36:38 +0000 Subject: [PATCH] 1 --- server/gameserver/creature.cc | 2 +- server/gameserver/creature.h | 1 + server/gameserver/human.cc | 8 +++++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index 2703b3c..7a41d60 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -2825,7 +2825,7 @@ void Creature::OnBattleStart(Room* room) bool Creature::CanFollow(Creature* follower) { - #ifdef DEBUG + #ifdef DEBUG1 return false; #endif if (follower->GetUniId() == GetUniId()) { diff --git a/server/gameserver/creature.h b/server/gameserver/creature.h index f9cfd44..c08b3e3 100644 --- a/server/gameserver/creature.h +++ b/server/gameserver/creature.h @@ -171,6 +171,7 @@ class Creature : public MoveableEntity bool IsHuman() const; bool IsCar() const; Human* AsHuman() { return IsHuman() ? (Human*)this : nullptr; }; + Player* AsPlayer() { return IsPlayer() ? (Player*)this : nullptr; }; Car* AsCar() { return IsCar() ? (Car*)this : nullptr; }; virtual void DecHP(float dec_hp, int killer_id, const std::string& killer_name, int weapon_id) {}; void AddHp(float hp); diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 15a4dcc..d63367d 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -3721,10 +3721,12 @@ void Human::DoFollow(int target_id) .SetSender(this), [] (const a8::XParams& param) { - Player* hum = (Player*)param.sender.GetUserData(); + Human* hum = (Human*)param.sender.GetUserData(); if (!hum->follow_target.Get()) { - hum->moving = false; - hum->moved_frames = 0; + if (hum->IsPlayer()) { + hum->AsPlayer()->moving = false; + hum->AsPlayer()->moved_frames = 0; + } hum->room->xtimer.DeleteTimer(hum->room->xtimer.GetRunningTimer()); return; }