This test is intended to avoid repeatedly calling 5 ScriptSetIntegers each script call, that won't ever change after the map is created.
--- 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;