refactor(Core/Movement): follower management of references (#25060)

Co-authored-by: Shauren <shauren.trinity@gmail.com>
This commit is contained in:
sogladev 2026-03-12 10:59:16 +01:00 committed by GitHub
parent a8a96eb8f8
commit 40f55bb0f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 28 additions and 135 deletions

View file

@ -20,9 +20,13 @@
void AbstractFollower::SetTarget(Unit* unit)
{
if (unit == GetTarget())
if (unit == _target)
return;
i_target.link(unit, this);
_target = i_target.getTarget();
if (_target)
_target->FollowerRemoved(this);
_target = unit;
if (_target)
_target->FollowerAdded(this);
}