make currentActivity private.

This commit is contained in:
Paul Chote
2010-11-29 13:47:50 +13:00
parent da74c6ad23
commit e97dd2ee47

View File

@@ -31,7 +31,7 @@ namespace OpenRA
[Sync] [Sync]
public Player Owner; public Player Owner;
IActivity currentActivity; private IActivity currentActivity;
public Group Group; public Group Group;
internal Actor(World world, string name, TypeDictionary initDict ) internal Actor(World world, string name, TypeDictionary initDict )
@@ -68,7 +68,10 @@ namespace OpenRA
public void Tick() public void Tick()
{ {
if (currentActivity == null || currentActivity is Idle) if (currentActivity == null)
currentActivity = new Idle();
if (currentActivity is Idle)
foreach (var ni in TraitsImplementing<INotifyIdle>()) foreach (var ni in TraitsImplementing<INotifyIdle>())
ni.TickIdle(this); ni.TickIdle(this);
@@ -77,7 +80,7 @@ namespace OpenRA
public bool IsIdle public bool IsIdle
{ {
get { return currentActivity == null || currentActivity is Idle; } get { return currentActivity is Idle; }
} }
OpenRA.FileFormats.Lazy<float2> Size; OpenRA.FileFormats.Lazy<float2> Size;
@@ -118,7 +121,7 @@ namespace OpenRA
public void QueueActivity( IActivity nextActivity ) public void QueueActivity( IActivity nextActivity )
{ {
if( currentActivity == null ) if( currentActivity is Idle )
currentActivity = nextActivity; currentActivity = nextActivity;
else else
currentActivity.Queue( nextActivity ); currentActivity.Queue( nextActivity );
@@ -126,11 +129,10 @@ namespace OpenRA
public void CancelActivity() public void CancelActivity()
{ {
if( currentActivity != null ) if( !(currentActivity is Idle) )
currentActivity.Cancel( this ); currentActivity.Cancel( this );
} }
// For pathdebug, et al
public IActivity GetCurrentActivity() public IActivity GetCurrentActivity()
{ {
return currentActivity; return currentActivity;