WithMuzzleFlash: fix loop variable in closure hazard

This fixes a real bug -- if the actor had multiple armaments, we'd end
up placing the muzzle flashes all based on the offsets of the last one.
This commit is contained in:
Chris Forbes
2014-10-07 18:27:31 +13:00
parent 98563eb854
commit 3360b11962

View File

@@ -38,6 +38,8 @@ namespace OpenRA.Mods.RA.Render
foreach (var arm in self.TraitsImplementing<Armament>())
{
var armClosure = arm; // closure hazard in AnimationWithOffset
// Skip armaments that don't define muzzles
if (arm.Info.MuzzleSequence == null)
continue;
@@ -55,7 +57,7 @@ namespace OpenRA.Mods.RA.Render
visible.Add(barrel, false);
anims.Add(barrel,
new AnimationWithOffset(muzzleFlash,
() => info.IgnoreOffset ? WVec.Zero : arm.MuzzleOffset(self, barrel),
() => info.IgnoreOffset ? WVec.Zero : armClosure.MuzzleOffset(self, barrel),
() => !visible[barrel],
() => false,
p => WithTurret.ZOffsetFromCenter(self, p, 2)));