# HG changeset patch # User Wuzzy # Date 1493319628 -7200 # Node ID 05fe955e276380c7eb2a70dfcc2b27e69d765340 # Parent a775a61e02abcc5c46dd6721542ad6bcb2583333 Fix engine crash in ACF mission 5 when skipping animation after killing wave 2 while the cyborg is talking Also harden the code against double function calls diff -r a775a61e02ab -r 05fe955e2763 share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/backstab.lua --- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/backstab.lua Thu Apr 27 19:09:01 2017 +0200 +++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/backstab.lua Thu Apr 27 21:00:28 2017 +0200 @@ -70,6 +70,9 @@ spyHog = nil deployedHog = nil deployedDead = false +nativesTeleported = false +nativesIsolated = false +hogDeployed = false cyborgHidden = false needToAct = 0 @@ -395,28 +398,31 @@ end function IsolateNatives() - PlaceGirder(710, 299, 6) - PlaceGirder(690, 299, 6) - PlaceGirder(761, 209, 4) - PlaceGirder(921, 209, 4) - PlaceGirder(1081, 209, 4) - PlaceGirder(761, 189, 4) - PlaceGirder(921, 189, 4) - PlaceGirder(1081, 189, 4) - PlaceGirder(761, 169, 4) - PlaceGirder(921, 169, 4) - PlaceGirder(1081, 169, 4) - PlaceGirder(761, 149, 4) - PlaceGirder(921, 149, 4) - PlaceGirder(1081, 149, 4) - PlaceGirder(761, 129, 4) - PlaceGirder(921, 129, 4) - PlaceGirder(1081, 129, 4) - PlaceGirder(1120, 261, 2) - PlaceGirder(1140, 261, 2) - PlaceGirder(1160, 261, 2) - AddAmmo(deployedHog, amDEagle, 0) - AddAmmo(deployedHog, amFirePunch, 0) + if not nativesIsolated then + PlaceGirder(710, 299, 6) + PlaceGirder(690, 299, 6) + PlaceGirder(761, 209, 4) + PlaceGirder(921, 209, 4) + PlaceGirder(1081, 209, 4) + PlaceGirder(761, 189, 4) + PlaceGirder(921, 189, 4) + PlaceGirder(1081, 189, 4) + PlaceGirder(761, 169, 4) + PlaceGirder(921, 169, 4) + PlaceGirder(1081, 169, 4) + PlaceGirder(761, 149, 4) + PlaceGirder(921, 149, 4) + PlaceGirder(1081, 149, 4) + PlaceGirder(761, 129, 4) + PlaceGirder(921, 129, 4) + PlaceGirder(1081, 129, 4) + PlaceGirder(1120, 261, 2) + PlaceGirder(1140, 261, 2) + PlaceGirder(1160, 261, 2) + AddAmmo(deployedHog, amDEagle, 0) + AddAmmo(deployedHog, amFirePunch, 0) + nativesIsolated = true + end end function PutCGI() @@ -443,11 +449,14 @@ end function TeleportNatives() - nativePos[waterNum] = {1100, 288} - for i = 1, 7 do - if nativeDead[i] ~= true then - AnimTeleportGear(natives[i], unpack(nativePos[i])) - end + if not nativesTeleported then + nativePos[waterNum] = {1100, 288} + for i = 1, 7 do + if nativeDead[i] ~= true then + AnimTeleportGear(natives[i], unpack(nativePos[i])) + end + end + nativesTeleported = true end end @@ -464,10 +473,13 @@ end function DeployHog() - AnimSwitchHog(deployedHog) - AnimTeleportGear(deployedHog, unpack(deployedPos)) - if deployedHog ~= natives[wiseNum] then - AnimSay(deployedHog, loc("Why me?!"), SAY_THINK, 2000) + if not hogDeployed then + AnimSwitchHog(deployedHog) + AnimTeleportGear(deployedHog, unpack(deployedPos)) + if deployedHog ~= natives[wiseNum] then + AnimSay(deployedHog, loc("Why me?!"), SAY_THINK, 2000) + end + hogDeployed = true end end @@ -546,10 +558,10 @@ function SkipWave2DeadAnim() TeleportNatives() - IsolateNatives() + PutCircles() DeployHog() + IsolateNatives() HideCyborg() - PutCircles() end function SpawnPlatformCrates() @@ -842,8 +854,7 @@ function SetupPlace() startNativesNum = nativesNum - HideHog(cyborg) - cyborgHidden = true + HideCyborg() for i = 1, 9 do HideHog(cannibals[i]) cannibalHidden[i] = true