From e97dd2ee4715f040a5cbaba31415da255a9335a4 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Mon, 29 Nov 2010 13:47:50 +1300 Subject: [PATCH] make currentActivity private. --- OpenRA.Game/Actor.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/OpenRA.Game/Actor.cs b/OpenRA.Game/Actor.cs index d9c89d8bf2..84b4a7a968 100755 --- a/OpenRA.Game/Actor.cs +++ b/OpenRA.Game/Actor.cs @@ -31,7 +31,7 @@ namespace OpenRA [Sync] public Player Owner; - IActivity currentActivity; + private IActivity currentActivity; public Group Group; internal Actor(World world, string name, TypeDictionary initDict ) @@ -68,7 +68,10 @@ namespace OpenRA public void Tick() { - if (currentActivity == null || currentActivity is Idle) + if (currentActivity == null) + currentActivity = new Idle(); + + if (currentActivity is Idle) foreach (var ni in TraitsImplementing()) ni.TickIdle(this); @@ -77,7 +80,7 @@ namespace OpenRA public bool IsIdle { - get { return currentActivity == null || currentActivity is Idle; } + get { return currentActivity is Idle; } } OpenRA.FileFormats.Lazy Size; @@ -118,7 +121,7 @@ namespace OpenRA public void QueueActivity( IActivity nextActivity ) { - if( currentActivity == null ) + if( currentActivity is Idle ) currentActivity = nextActivity; else currentActivity.Queue( nextActivity ); @@ -126,11 +129,10 @@ namespace OpenRA public void CancelActivity() { - if( currentActivity != null ) + if( !(currentActivity is Idle) ) currentActivity.Cancel( this ); } - // For pathdebug, et al public IActivity GetCurrentActivity() { return currentActivity;