# HG changeset patch # User Wuzzy # Date 1519392418 -3600 # Node ID bcb87269867ec4b61635b4a3b0712ee0fc22a916 # Parent 8d2087c85b8d66e5e527c8ac897228420c19b877 Lua API: Fix SetWind not updating flake direction diff -r 8d2087c85b8d -r bcb87269867e ChangeLog.txt --- a/ChangeLog.txt Fri Feb 23 14:10:03 2018 +0100 +++ b/ChangeLog.txt Fri Feb 23 14:26:58 2018 +0100 @@ -80,6 +80,7 @@ + New callback: onEndTurn(): Called at the end of a turn (when gears have settled) * AddAmmo now automatically unselects weapon if it would remove current ammo from current hedgehog * Fix call: SetWeapon(amNothing) now unselects weapon + * Fix call: SetWind did not update flake flying direction * Fix global: TotalRounds was stuck at -1 for several turns ====================== 0.9.23 ====================== diff -r 8d2087c85b8d -r bcb87269867e hedgewars/uScript.pas --- a/hedgewars/uScript.pas Fri Feb 23 14:10:03 2018 +0100 +++ b/hedgewars/uScript.pas Fri Feb 23 14:26:58 2018 +0100 @@ -2514,14 +2514,17 @@ end; function lc_setwind(L : Plua_State) : LongInt; Cdecl; +var vg: PVisualGear; begin if CheckLuaParamCount(L, 1, 'SetWind', 'windSpeed') then begin cWindSpeed:= int2hwfloat(Trunc(lua_tonumber(L, 1))) / 100 * cMaxWindSpeed; cWindSpeedf:= SignAs(cWindSpeed,cWindSpeed).QWordValue / SignAs(_1,_1).QWordValue; if cWindSpeed.isNegative then - CWindSpeedf := -cWindSpeedf; - AddVisualGear(0, 0, vgtSmoothWindBar); + cWindSpeedf := -cWindSpeedf; + vg:= AddVisualGear(0, 0, vgtSmoothWindBar); + if vg <> nil then vg^.dAngle:= hwFloat2Float(cWindSpeed); + AddFileLog('Wind = '+FloatToStr(cWindSpeed)); end; lc_setwind:= 0 end;