hedgewars/uScript.pas
changeset 13752 f1c66a34f2fe
parent 13750 110d6c1e817f
child 13764 c46998ecd8fa
--- a/hedgewars/uScript.pas	Mon Sep 03 12:59:54 2018 +0200
+++ b/hedgewars/uScript.pas	Mon Sep 03 20:01:50 2018 +0200
@@ -40,6 +40,7 @@
 procedure ScriptOnScreenResize;
 procedure ScriptSetInteger(name : shortstring; value : LongInt);
 procedure ScriptSetString(name : shortstring; value : shortstring);
+procedure ScriptSetMapGlobals;
 
 procedure ScriptCall(fname : shortstring);
 function ScriptCall(fname : shortstring; par1: LongInt) : LongInt;
@@ -99,7 +100,6 @@
     ScriptAmmoDelay : shortstring;
     ScriptAmmoReinforcement : shortstring;
     ScriptLoaded : boolean;
-    mapDims : boolean;
     PointsBuffer: shortstring;
     PrevCursorX, PrevCursorY: LongInt;
     PendingTurnTimeLeft, PendingReadyTimeLeft: LongWord;
@@ -3540,7 +3540,6 @@
 
 ScriptSetInteger('ClansCount', ClansCount);
 ScriptSetInteger('TeamsCount', TeamsCount);
-mapDims:= false
 end;
 
 
@@ -3709,21 +3708,21 @@
     PrevCursorY:= NoPointX
     end;
 
-if not mapDims then
-    begin
-    mapDims:= true;
-    ScriptSetInteger('LAND_WIDTH', LAND_WIDTH);
-    ScriptSetInteger('LAND_HEIGHT', LAND_HEIGHT);
-    ScriptSetInteger('LeftX', leftX);
-    ScriptSetInteger('RightX', rightX);
-    ScriptSetInteger('TopY', topY)
-    end;
 if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) then
     ScriptSetInteger('CurrentHedgehog', CurrentHedgehog^.Gear^.UID)
 else
     ScriptSetNil('CurrentHedgehog');
 end;
 
+procedure ScriptSetMapGlobals;
+begin
+ScriptSetInteger('LAND_WIDTH', LAND_WIDTH);
+ScriptSetInteger('LAND_HEIGHT', LAND_HEIGHT);
+ScriptSetInteger('LeftX', leftX);
+ScriptSetInteger('RightX', rightX);
+ScriptSetInteger('TopY', topY);
+end;
+
 procedure GetGlobals;
 var currentTTL, currentRTL, newTTL, newRTL: LongInt;
 begin
@@ -4382,7 +4381,6 @@
 
 procedure initModule;
 begin
-mapDims:= false;
 PointsBuffer:= '';
 PrevCursorX:= NoPointX;
 PrevCursorY:= NoPointX;