From 09b887abf2738e96d24beb92cca00d293d84134a Mon Sep 17 00:00:00 2001 From: reaperrr Date: Tue, 5 Aug 2014 13:19:26 +0200 Subject: [PATCH] Streamline isValid check. --- OpenRA.Mods.RA/Warheads/CreateEffectWarhead.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/OpenRA.Mods.RA/Warheads/CreateEffectWarhead.cs b/OpenRA.Mods.RA/Warheads/CreateEffectWarhead.cs index f5608df22d..e22cf62c76 100644 --- a/OpenRA.Mods.RA/Warheads/CreateEffectWarhead.cs +++ b/OpenRA.Mods.RA/Warheads/CreateEffectWarhead.cs @@ -83,16 +83,15 @@ namespace OpenRA.Mods.RA { var world = firedBy.World; var targetTile = world.Map.CellContaining(pos); - - if (!world.Map.Contains(targetTile)) - return; - var isValid = IsValidImpact(pos, firedBy); - if ((Explosion != null) && isValid) + if ((!world.Map.Contains(targetTile)) || (!isValid)) + return; + + if (Explosion != null) world.AddFrameEndTask(w => w.Add(new Explosion(w, pos, Explosion, ExplosionPalette))); - if ((ImpactSound != null) && isValid) + if (ImpactSound != null) Sound.Play(ImpactSound, pos); }