This commit is contained in:
aozhiwei 2021-09-28 16:36:38 +00:00
parent 5e3b8e2774
commit ee22da622e
3 changed files with 7 additions and 4 deletions

View File

@ -2825,7 +2825,7 @@ void Creature::OnBattleStart(Room* room)
bool Creature::CanFollow(Creature* follower) bool Creature::CanFollow(Creature* follower)
{ {
#ifdef DEBUG #ifdef DEBUG1
return false; return false;
#endif #endif
if (follower->GetUniId() == GetUniId()) { if (follower->GetUniId() == GetUniId()) {

View File

@ -171,6 +171,7 @@ class Creature : public MoveableEntity
bool IsHuman() const; bool IsHuman() const;
bool IsCar() const; bool IsCar() const;
Human* AsHuman() { return IsHuman() ? (Human*)this : nullptr; }; Human* AsHuman() { return IsHuman() ? (Human*)this : nullptr; };
Player* AsPlayer() { return IsPlayer() ? (Player*)this : nullptr; };
Car* AsCar() { return IsCar() ? (Car*)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) {}; virtual void DecHP(float dec_hp, int killer_id, const std::string& killer_name, int weapon_id) {};
void AddHp(float hp); void AddHp(float hp);

View File

@ -3721,10 +3721,12 @@ void Human::DoFollow(int target_id)
.SetSender(this), .SetSender(this),
[] (const a8::XParams& param) [] (const a8::XParams& param)
{ {
Player* hum = (Player*)param.sender.GetUserData(); Human* hum = (Human*)param.sender.GetUserData();
if (!hum->follow_target.Get()) { if (!hum->follow_target.Get()) {
hum->moving = false; if (hum->IsPlayer()) {
hum->moved_frames = 0; hum->AsPlayer()->moving = false;
hum->AsPlayer()->moved_frames = 0;
}
hum->room->xtimer.DeleteTimer(hum->room->xtimer.GetRunningTimer()); hum->room->xtimer.DeleteTimer(hum->room->xtimer.GetRunningTimer());
return; return;
} }