ShoppaMap: Can change map complexity with slider, remove script param “pad”
authorWuzzy <Wuzzy2@mail.ru>
Sat, 24 Mar 2018 23:45:16 +0100
changeset 13279 9ac674499985
parent 13278 7476c1a50738
child 13280 e469de43aa67
ShoppaMap: Can change map complexity with slider, remove script param “pad”
ChangeLog.txt
share/hedgewars/Data/Scripts/Multiplayer/ShoppaMap.lua
--- a/ChangeLog.txt	Sat Mar 24 23:13:57 2018 +0100
+++ b/ChangeLog.txt	Sat Mar 24 23:45:16 2018 +0100
@@ -66,6 +66,8 @@
  + HedgeEditor: Show cursor coordinates in top left corner
  + Control: Always remove TimeBox and Resurrector
  + Climb Home: Show messages when a fire cake is nearby and when you're inside home
+ + ShoppaMap: Map complexity can now be changed with the slider
+ + ShoppaMap: Remove script parameter “pad”
  * The Specialists: Less buggy hog switching at turn start
  * Mutant: When game ends due to all land being gone, declare the highest-scoring team the winner
  * Battalion: Some texts in the mission panel were wrong and misleading
--- a/share/hedgewars/Data/Scripts/Multiplayer/ShoppaMap.lua	Sat Mar 24 23:13:57 2018 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/ShoppaMap.lua	Sat Mar 24 23:45:16 2018 +0100
@@ -4,13 +4,11 @@
 
 -- Overall padding for roping freedom
 local Padding = 430
+-- If true, rope assumes team color
 local TeamRope = false
 
 function onParameters()
     parseParams()
-    if params["pad"] ~= nil then
-        Padding = params["pad"]
-    end
     if params["teamrope"] ~= nil then
         TeamRope = true
     end
@@ -329,6 +327,15 @@
 end
 
 function onGameInit()
+    -- Calculate padding, determined  by map feature size
+    if MapFeatureSize <= 20 then
+        -- 10 .. 710. Step size=35
+        Padding = 10 + MapFeatureSize * 35
+    else
+        -- 780 .. 1060. Step size=70
+        Padding = 710 + (MapFeatureSize-20) * 70
+    end
+
     MapGen = mgDrawn
     TemplateFilter = 0
     local TotGen = 0