use constants for mapgen, expose those to lua
authorsheepluva
Thu, 02 Oct 2014 00:40:25 +0200
changeset 10421 87e47843018e
parent 10419 e19a864e2fab
child 10423 b9d6463cf2ca
use constants for mapgen, expose those to lua
hedgewars/uConsts.pas
hedgewars/uLand.pas
hedgewars/uScript.pas
tests/lua/drillrockets_boom.lua
tests/lua/drillrockets_drill.lua
tests/lua/hellfire_burns.lua
--- a/hedgewars/uConsts.pas	Thu Oct 02 00:06:59 2014 +0200
+++ b/hedgewars/uConsts.pas	Thu Oct 02 00:40:25 2014 +0200
@@ -316,6 +316,12 @@
 
     cMinPlayWidth = 200;
 
+    // MapGen
+    mgRandom = 0;
+    mgMaze   = 1;
+    mgPerlin = 2;
+    mgDrawn  = 3;
+
 implementation
 
 end.
--- a/hedgewars/uLand.pas	Thu Oct 02 00:06:59 2014 +0200
+++ b/hedgewars/uLand.pas	Thu Oct 02 00:40:25 2014 +0200
@@ -545,10 +545,10 @@
             begin
             WriteLnToConsole('Generating land...');
             case cMapGen of
-                0: GenTemplated(EdgeTemplates[SelectTemplate]);
-                1: begin ResizeLand(4096,2048); GenMaze; end;
-                2: begin ResizeLand(4096,2048); GenPerlin; end;
-                3: GenDrawnMap;
+                mgRandom: GenTemplated(EdgeTemplates[SelectTemplate]);
+                mgMaze  : begin ResizeLand(4096,2048); GenMaze; end;
+                mgPerlin: begin ResizeLand(4096,2048); GenPerlin; end;
+                mgDrawn : GenDrawnMap;
             else
                 OutError('Unknown mapgen', true);
             end;
--- a/hedgewars/uScript.pas	Thu Oct 02 00:06:59 2014 +0200
+++ b/hedgewars/uScript.pas	Thu Oct 02 00:40:25 2014 +0200
@@ -2751,8 +2751,14 @@
 
 // land flags
 ScriptSetInteger('lfIndestructible', lfIndestructible);
-ScriptSetInteger('lfIce',            lfIce);
-ScriptSetInteger('lfBouncy',         lfBouncy);
+ScriptSetInteger('lfIce'           , lfIce);
+ScriptSetInteger('lfBouncy'        , lfBouncy);
+
+// mapgen
+ScriptSetInteger('mgRandom', mgRandom);
+ScriptSetInteger('mgMaze'  , mgMaze);
+ScriptSetInteger('mgPerlin', mgPerlin);
+ScriptSetInteger('mgDrawn' , mgDrawn);
 
 // register functions
 lua_register(luaState, _P'HideHog', @lc_hidehog);
--- a/tests/lua/drillrockets_boom.lua	Thu Oct 02 00:06:59 2014 +0200
+++ b/tests/lua/drillrockets_boom.lua	Thu Oct 02 00:40:25 2014 +0200
@@ -71,7 +71,7 @@
 	-- The base number for the random number generator
 	Seed = 1
 	-- The map to be played
-	MapGen = 2
+	MapGen = mgDrawn
 	-- The theme to be used
 	Theme = "Bamboo"
 	-- Game settings and rules
--- a/tests/lua/drillrockets_drill.lua	Thu Oct 02 00:06:59 2014 +0200
+++ b/tests/lua/drillrockets_drill.lua	Thu Oct 02 00:40:25 2014 +0200
@@ -65,7 +65,7 @@
 	-- The base number for the random number generator
 	Seed = 1
 	-- The map to be played
-	MapGen = 2
+	MapGen = mgDrawn
 	-- The theme to be used
 	Theme = "Bamboo"
 	-- Game settings and rules
--- a/tests/lua/hellfire_burns.lua	Thu Oct 02 00:06:59 2014 +0200
+++ b/tests/lua/hellfire_burns.lua	Thu Oct 02 00:40:25 2014 +0200
@@ -62,7 +62,7 @@
 	-- The base number for the random number generator
 	Seed = 1
 	-- The map to be played
-	MapGen = 2
+	MapGen = mgDrawn
 	-- The theme to be used
 	Theme = "Bamboo"
 	-- Game settings and rules