Small tweak to return something more useful in the negative 0 case on dX
authornemo
Tue, 13 Mar 2012 12:10:48 -0400
changeset 6779 ccd8aecaff6d
parent 6778 a9c6457dca29
child 6780 166ee5275915
Small tweak to return something more useful in the negative 0 case on dX
hedgewars/uScript.pas
--- a/hedgewars/uScript.pas	Tue Mar 13 00:05:03 2012 -0400
+++ b/hedgewars/uScript.pas	Tue Mar 13 12:10:48 2012 -0400
@@ -1397,7 +1397,9 @@
         gear:= GearByUID(lua_tointeger(L, 1));
         if gear <> nil then
             begin
-            lua_pushinteger(L, hwRound(gear^.dX * 1000000));
+            // gear dX determines hog orientation
+            if (gear^.dX.isNegative) and (gear^.dX = _0) then lua_pushinteger(L, -1)
+            else lua_pushinteger(L, hwRound(gear^.dX * 1000000));
             lua_pushinteger(L, hwRound(gear^.dY * 1000000))
             end
         end;