This test is intended to avoid repeatedly calling 5 ScriptSetIntegers each script call, that won't ever change after the map is created.
authornemo
Mon, 21 Oct 2013 12:38:24 -0400
changeset 9567 42bc1b58a242
parent 9565 7f786eb439aa
child 9569 dd1861ca4def
This test is intended to avoid repeatedly calling 5 ScriptSetIntegers each script call, that won't ever change after the map is created.
hedgewars/uScript.pas
--- a/hedgewars/uScript.pas	Sun Oct 20 20:10:09 2013 -0400
+++ b/hedgewars/uScript.pas	Mon Oct 21 12:38:24 2013 -0400
@@ -95,6 +95,7 @@
     ScriptAmmoDelay : shortstring;
     ScriptAmmoReinforcement : shortstring;
     ScriptLoaded : boolean;
+    mapDims : boolean;
 
 procedure ScriptPrepareAmmoStore; forward;
 procedure ScriptApplyAmmoStore; forward;
@@ -2065,7 +2066,8 @@
     end;
 
 ScriptSetInteger('ClansCount', ClansCount);
-ScriptSetInteger('TeamsCount', TeamsCount)
+ScriptSetInteger('TeamsCount', TeamsCount);
+mapDims:= false
 end;
 
 
@@ -2122,8 +2124,9 @@
 ScriptSetInteger('GameTime', GameTicks);
 ScriptSetInteger('TotalRounds', TotalRounds);
 ScriptSetInteger('WaterLine', cWaterLine);
-if GameTicks = 0 then
+if not mapDims then
     begin
+    mapDims:= true;
     ScriptSetInteger('LAND_WIDTH', LAND_WIDTH);
     ScriptSetInteger('LAND_HEIGHT', LAND_HEIGHT);
     ScriptSetInteger('LeftX', leftX);
@@ -2621,6 +2624,7 @@
 
 procedure initModule;
 begin
+mapDims:= false;
 end;
 
 procedure freeModule;