Turn Actor.GetCurrentActivity into a property

This commit is contained in:
Oliver Brakmann
2016-10-29 16:56:31 +02:00
parent 04dbda6dcd
commit 3e9bf7aa4d
8 changed files with 19 additions and 24 deletions

View File

@@ -794,8 +794,7 @@ namespace OpenRA.Mods.Common.AI
if (!harvester.IsIdle)
{
var act = harvester.GetCurrentActivity();
var act = harvester.CurrentActivity;
if (act.NextActivity == null || act.NextActivity.GetType() != typeof(FindResources))
continue;
}

View File

@@ -125,10 +125,10 @@ namespace OpenRA.Mods.Common.AI
protected static bool IsRearm(Actor a)
{
var activity = a.GetCurrentActivity();
if (activity == null)
if (a.IsIdle)
return false;
var activity = a.CurrentActivity;
var type = activity.GetType();
if (type == typeof(Rearm) || type == typeof(ResupplyAircraft))
return true;

View File

@@ -44,15 +44,16 @@ namespace OpenRA.Mods.Common.AI
if (a.IsIdle)
return false;
var type = a.GetCurrentActivity().GetType();
var activity = a.CurrentActivity;
var type = activity.GetType();
if (type == typeof(Attack) || type == typeof(FlyAttack))
return true;
var next = a.GetCurrentActivity().NextActivity;
var next = activity.NextActivity;
if (next == null)
return false;
var nextType = a.GetCurrentActivity().NextActivity.GetType();
var nextType = next.GetType();
if (nextType == typeof(Attack) || nextType == typeof(FlyAttack))
return true;