From e187b985fe2f29e1824d6f6a8a7b67051a777dcc Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 5 Nov 2016 17:45:27 +0000 Subject: [PATCH] Prevent smudges from spawning in bogus cells. --- OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs b/OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs index d275fd4d01..c6ff277b45 100644 --- a/OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs @@ -139,6 +139,9 @@ namespace OpenRA.Mods.Common.Traits public void AddSmudge(CPos loc) { + if (!world.Map.Contains(loc)) + return; + 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))); @@ -167,6 +170,9 @@ namespace OpenRA.Mods.Common.Traits public void RemoveSmudge(CPos loc) { + if (!world.Map.Contains(loc)) + return; + var tile = dirty.ContainsKey(loc) ? dirty[loc] : new Smudge(); // Setting Sprite to null to indicate a deleted smudge.