From f463407d8d74575681ac5c7f5f788fdbbed85a05 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Mon, 29 Sep 2014 20:57:20 +1300 Subject: [PATCH] Fix a loop closure bug in the weapons code. Fixes #6597. Fixes #6599. --- OpenRA.Game/GameRules/WeaponInfo.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenRA.Game/GameRules/WeaponInfo.cs b/OpenRA.Game/GameRules/WeaponInfo.cs index 0095f4cea5..c675ace60b 100644 --- a/OpenRA.Game/GameRules/WeaponInfo.cs +++ b/OpenRA.Game/GameRules/WeaponInfo.cs @@ -150,8 +150,9 @@ namespace OpenRA.GameRules ///Applies all the weapon's warheads to the target. public void Impact(Target target, Actor firedBy, IEnumerable damageModifiers) { - foreach (var wh in Warheads) + foreach (var warhead in Warheads) { + var wh = warhead; // force the closure to bind to the current warhead Action a; a = () => wh.DoImpact(target, firedBy, damageModifiers);