Remove ContrailFader when complete. Fixes #4302.

This commit is contained in:
Paul Chote
2013-12-13 22:32:45 +13:00
parent 45ccf0035e
commit 393b1bbc0a
2 changed files with 6 additions and 0 deletions

View File

@@ -15,6 +15,8 @@ namespace OpenRA.Graphics
{
public struct ContrailRenderable : IRenderable
{
public int Length { get { return trail.Length; } }
readonly World world;
// Store trail positions in a circular buffer

View File

@@ -18,6 +18,7 @@ namespace OpenRA.Mods.RA.Effects
{
WPos pos;
ContrailRenderable trail;
int ticks;
public ContrailFader(WPos pos, ContrailRenderable trail)
{
@@ -27,6 +28,9 @@ namespace OpenRA.Mods.RA.Effects
public void Tick(World world)
{
if (ticks++ == trail.Length)
world.AddFrameEndTask(w => w.Remove(this));
trail.Update(pos);
}