hedgewars/uScript.pas
changeset 10660 79fa79c77c38
parent 10634 35d059bd0932
child 10671 17dd6265a08a
--- a/hedgewars/uScript.pas	Thu Dec 11 15:20:23 2014 +0100
+++ b/hedgewars/uScript.pas	Thu Dec 11 17:50:05 2014 +0100
@@ -2277,17 +2277,17 @@
 
 
 function lc_addPoint(L : Plua_State) : LongInt; Cdecl;
-var np, param: integer;
+var np, param: LongInt;
 begin
     if CheckAndFetchParamCountRange(L, 2, 4, 'AddPoint', 'x, y [, width [, erase] ]', np) then
         begin
         // x
-        param:= lua_tointeger(L,1);
-        PointsBuffer:= PointsBuffer + char((param and $FF00) shr 8);
+        param:= LongInt(lua_tointeger(L,1));
+        PointsBuffer:= PointsBuffer + char((param shr 8) and $FF);
         PointsBuffer:= PointsBuffer + char((param and $FF));
         // y
-        param:= lua_tointeger(L,2);
-        PointsBuffer:= PointsBuffer + char((param and $FF00) shr 8);
+        param:= LongInt(lua_tointeger(L,2));
+        PointsBuffer:= PointsBuffer + char((param shr 8) and $FF);
         PointsBuffer:= PointsBuffer + char((param and $FF));
         // width
         if np > 2 then