refactor(Core/Movement): follower management of references (#25060)
Co-authored-by: Shauren <shauren.trinity@gmail.com>
This commit is contained in:
parent
a8a96eb8f8
commit
40f55bb0f3
9 changed files with 28 additions and 135 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue