Fix Construction Mode screwing up when initialenergy > maxenergy
authorWuzzy <almikes@aol.com>
Wed, 23 Nov 2016 00:28:58 +0100
changeset 11982 6f4b96669f9d
parent 11981 acae870a66b9
child 11983 9e57915f5365
Fix Construction Mode screwing up when initialenergy > maxenergy
share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua	Wed Nov 23 00:17:28 2016 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua	Wed Nov 23 00:28:58 2016 +0100
@@ -30,6 +30,7 @@
 --
 -- Possible keys:
 --- initialenergy: Amount of energy that each team starts with (default: 550)
+---                Note: Must be smaller than or equal to maxenergy
 --- energyperround: Amount of energy that each team gets per round (default: 50)
 --- maxenergy: Maximum amount of energy each team can hold (default: 1000)
 
@@ -1594,7 +1595,7 @@
 	SetVisualGearValues(sCirc, 0, 0, 100, 255, 1, 10, 0, 40, 3, 0x00000000)
 
 	for i = 0, ClansCount-1 do
-		clanPower[i] = conf_initialEnergy
+		clanPower[i] = math.min(conf_initialEnergy, conf_maxEnergy)
 		clanLWepIndex[i] = 1 -- for ease of use let's track this stuff
 		clanLUtilIndex[i] = 1
 		clanLGearIndex[i] = 1