# HG changeset patch # User Wuzzy # Date 1509073438 -7200 # Node ID 389453e1e09e6f6a0a0e602dcd83d960c6fd3067 # Parent 9892d596693e897a98afe03784e620e19bf34c1f ACF7: Fix possible Lua error spam in intro sequence This was caused by a race of onGearDelete vs AnimationSetup. If AnimationSetup came first, it uses old values from the natives table. The solution is to force the code to guarantee that AnimationSetup always coms after deleting gears in the natives table. diff -r 9892d596693e -r 389453e1e09e ChangeLog.txt --- a/ChangeLog.txt Fri Oct 27 02:17:39 2017 +0200 +++ b/ChangeLog.txt Fri Oct 27 05:03:58 2017 +0200 @@ -247,6 +247,7 @@ * Mission 5: Fix final animation being stuck if cyborg's way to the left is blocked * Mission 6: Block off left cave entrance to stop player to just rope all the way around * Mission 6: Fix mines not being able to get triggered in first turn + * Mission 7: Fix possible Lua error message spam in intro sequence * Mission 8: Fix Lua error message at the beginning * Mission 10: Fix mission becoming unplayable when all hogs except the traitor died * All missions: Add missing texts for translation diff -r 9892d596693e -r 389453e1e09e share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/queen.lua --- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/queen.lua Fri Oct 27 02:17:39 2017 +0200 +++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/queen.lua Fri Oct 27 05:03:58 2017 +0200 @@ -100,6 +100,8 @@ fleeAnim = {} finalAnim = {} leaderDeadAnim = {} + +nativeAwaitingDeletion = nil -----------------------------Animations-------------------------------- function EmitDenseClouds(dir) local dif @@ -648,7 +650,10 @@ if GetHogName(natives[i]) == GetHogName(enemy) then AnimSetGearPosition(enemy, GetGearPosition(natives[i])) DeleteGear(natives[i]) + -- triggers AfterSetupPlace when the gear is *actually* deleted + nativeAwaitingDeletion = natives[i] DeleteGear(cyborgs[cyborgsLeft]) + break end end @@ -762,6 +767,10 @@ function onGameStart() SetupAmmo() SetupPlace() + -- Animation is setup in AfterSetupPlace +end + +function AfterSetupPlace() AnimationSetup() SetupEvents() AddAnim(startAnim) @@ -791,6 +800,10 @@ end table.remove(natives, toRemove) nativesLeft = nativesLeft - 1 + if nativeAwaitingDeletion and gear == nativeAwaitingDeletion then + AfterSetupPlace() + nativeAwaitingDeletion = nil + end end end end