Fix a potential crash when cancelling capture
This commit is contained in:
@@ -152,7 +152,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
void CancelCapture()
|
||||
{
|
||||
manager.CancelCapture(enterCaptureManager);
|
||||
manager.CancelCapture(enterActor, enterCaptureManager);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (target != currentTarget)
|
||||
{
|
||||
if (currentTargetManager != null)
|
||||
CancelCapture(currentTargetManager);
|
||||
CancelCapture(currentTarget, currentTargetManager);
|
||||
|
||||
targetManager.currentCaptors.Add(self);
|
||||
currentTarget = target;
|
||||
@@ -239,12 +239,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
/// This method revokes the capturing conditions on the captor and target
|
||||
/// and resets any capturing progress.
|
||||
/// </summary>
|
||||
public void CancelCapture(CaptureManager targetManager)
|
||||
public void CancelCapture(Actor target, CaptureManager targetManager)
|
||||
{
|
||||
if (currentTarget == null)
|
||||
return;
|
||||
|
||||
var target = targetManager.self;
|
||||
foreach (var w in progressWatchers)
|
||||
w.Update(self, self, target, 0, 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user