fixed unit production bug; unit is not emitted until space is clear.

This commit is contained in:
Chris Forbes
2009-11-17 20:17:25 +13:00
parent 7711a0bf01
commit a2de047c9f
4 changed files with 40 additions and 8 deletions

View File

@@ -120,7 +120,13 @@ namespace OpenRa.Game
public void Tick( Player player )
{
if( Paused || Done ) return;
if (Done)
{
if (OnComplete != null) OnComplete();
return;
}
if( Paused ) return;
var costThisFrame = RemainingCost / RemainingTime;
if( costThisFrame != 0 && !player.TakeCash( costThisFrame ) ) return;
@@ -129,10 +135,7 @@ namespace OpenRa.Game
RemainingTime -= 1;
if( RemainingTime > 0 ) return;
// item finished; do whatever needs done.
Done = true;
if (OnComplete != null)
OnComplete();
}
}
}