Activity.Cancel returns void instead of bool.

This commit is contained in:
tovl
2019-03-09 15:49:12 +01:00
committed by Paul Chote
parent a17cd0fa06
commit 705795abde
13 changed files with 31 additions and 63 deletions

View File

@@ -206,12 +206,12 @@ namespace OpenRA.Mods.Common.Activities
});
}
public override bool Cancel(Actor self, bool keepQueue = false)
public override void Cancel(Actor self, bool keepQueue = false)
{
if (!IsCanceling && innerActivity != null)
innerActivity.Cancel(self);
return base.Cancel(self);
base.Cancel(self);
}
}
}

View File

@@ -160,14 +160,14 @@ namespace OpenRA.Mods.Common.Activities
return this;
}
public override bool Cancel(Actor self, bool keepQueue = false)
public override void Cancel(Actor self, bool keepQueue = false)
{
OnCancel(self);
if (!IsCanceling && moveActivity != null)
moveActivity.Cancel(self);
return base.Cancel(self, keepQueue);
base.Cancel(self, keepQueue);
}
}
}

View File

@@ -133,12 +133,12 @@ namespace OpenRA.Mods.Common.Activities
return NextActivity;
}
public override bool Cancel(Actor self, bool keepQueue = false)
public override void Cancel(Actor self, bool keepQueue = false)
{
if (!IsCanceling && enterTransport != null)
enterTransport.Cancel(self);
return base.Cancel(self, keepQueue);
base.Cancel(self, keepQueue);
}
}
}

View File

@@ -81,10 +81,10 @@ namespace OpenRA.Mods.Common.Activities
throw new InvalidOperationException("Invalid harvester dock state");
}
public override bool Cancel(Actor self, bool keepQueue = false)
public override void Cancel(Actor self, bool keepQueue = false)
{
dockingState = DockingState.Undock;
return base.Cancel(self);
base.Cancel(self);
}
public override IEnumerable<Target> GetTargets(Actor self)

View File

@@ -46,12 +46,12 @@ namespace OpenRA.Mods.Common.Activities
return this;
}
public override bool Cancel(Actor self, bool keepQueue = false)
public override void Cancel(Actor self, bool keepQueue = false)
{
if (!IsCanceling && inner != null)
inner.Cancel(self);
return base.Cancel(self, keepQueue);
base.Cancel(self, keepQueue);
}
public override IEnumerable<Target> GetTargets(Actor self)

View File

@@ -167,12 +167,12 @@ namespace OpenRA.Mods.Common.Activities
return Target.None;
}
public override bool Cancel(Actor self, bool keepQueue = false)
public override void Cancel(Actor self, bool keepQueue = false)
{
if (!IsCanceling && inner != null)
inner.Cancel(self);
return base.Cancel(self);
base.Cancel(self);
}
}
}

View File

@@ -159,12 +159,12 @@ namespace OpenRA.Mods.Common.Activities
});
}
public override bool Cancel(Actor self, bool keepQueue = false)
public override void Cancel(Actor self, bool keepQueue = false)
{
if (!IsCanceling && innerActivity != null)
innerActivity.Cancel(self);
return base.Cancel(self, keepQueue);
base.Cancel(self, keepQueue);
}
}
}

View File

@@ -27,17 +27,11 @@ namespace OpenRA.Mods.Common.Activities
public override Activity Tick(Actor self)
{
if (IsCanceling)
return NextActivity;
return (remainingTicks-- == 0) ? NextActivity : this;
}
public override bool Cancel(Actor self, bool keepQueue = false)
{
if (!base.Cancel(self, keepQueue))
return false;
remainingTicks = 0;
return true;
}
}
public class WaitFor : Activity
@@ -53,16 +47,10 @@ namespace OpenRA.Mods.Common.Activities
public override Activity Tick(Actor self)
{
if (IsCanceling)
return NextActivity;
return (f == null || f()) ? NextActivity : this;
}
public override bool Cancel(Actor self, bool keepQueue = false)
{
if (!base.Cancel(self, keepQueue))
return false;
f = null;
return true;
}
}
}

View File

@@ -41,12 +41,12 @@ namespace OpenRA.Mods.Common.Activities
return this;
}
public override bool Cancel(Actor self, bool keepQueue = false)
public override void Cancel(Actor self, bool keepQueue = false)
{
if (!IsCanceling && inner != null)
inner.Cancel(self);
return base.Cancel(self, keepQueue);
base.Cancel(self, keepQueue);
}
}
}

View File

@@ -43,11 +43,11 @@ namespace OpenRA.Mods.Common.Activities
return NextActivity;
}
public override bool Cancel(Actor self, bool keepQueue = false)
public override void Cancel(Actor self, bool keepQueue = false)
{
base.Cancel(self, keepQueue);
Dispose();
return true;
return;
}
public void Dispose()

View File

@@ -51,8 +51,8 @@ namespace OpenRA.Mods.Common.Traits
transform.Facing = facing.Facing;
transform.SkipMakeAnims = info.SkipMakeAnims;
if (crusher.CancelActivity())
crusher.QueueActivity(transform);
crusher.CancelActivity();
crusher.QueueActivity(transform);
}
}
}