--- 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 ======================
--- 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;