diff --git a/OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs b/OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs index f12873d3a0..48ac92f81b 100644 --- a/OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs @@ -142,6 +142,7 @@ namespace OpenRA.Mods.Common.Traits if (Game.CosmeticRandom.Next(0, 100) <= Info.SmokePercentage) world.AddFrameEndTask(w => w.Add(new SpriteEffect(world.Map.CenterOfCell(loc), w, Info.SmokeType, Info.SmokeSequence, Info.SmokePalette))); + // A null Sprite indicates a deleted smudge. if ((!dirty.ContainsKey(loc) || dirty[loc].Sprite == null) && !tiles.ContainsKey(loc)) { // No smudge; create a new one @@ -151,6 +152,7 @@ namespace OpenRA.Mods.Common.Traits else { // Existing smudge; make it deeper + // A null Sprite indicates a deleted smudge. var tile = dirty.ContainsKey(loc) && dirty[loc].Sprite != null ? dirty[loc] : tiles[loc]; var maxDepth = smudges[tile.Type].Length; if (tile.Depth < maxDepth - 1) @@ -167,6 +169,7 @@ namespace OpenRA.Mods.Common.Traits { var tile = dirty.ContainsKey(loc) ? dirty[loc] : new Smudge(); + // Setting Sprite to null to indicate a deleted smudge. tile.Sprite = null; dirty[loc] = tile; } @@ -178,6 +181,7 @@ namespace OpenRA.Mods.Common.Traits { if (!self.World.FogObscures(kv.Key)) { + // A null Sprite indicates a deleted smudge. if (kv.Value.Sprite == null) tiles.Remove(kv.Key); else