Construction Mode: Update team labels more reliably
authorWuzzy <Wuzzy2@mail.ru>
Thu, 29 Nov 2018 20:37:40 +0100
changeset 14353 ffebbcc40c9b
parent 14352 1dcc37b6913e
child 14354 d35e0fdb70f6
Construction Mode: Update team labels more reliably
share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua	Thu Nov 29 20:09:01 2018 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua	Thu Nov 29 20:37:40 2018 +0100
@@ -286,12 +286,14 @@
 end
 
 function RenderClanPower()
+	DrawClanPowerTag()
+end
+
+function UpdateTeamLabels()
 	for i=0, TeamsCount-1 do
 		local name = GetTeamName(i)
 		SetTeamLabel(name, clanPower[GetTeamClan(name)])
 	end
-
-	DrawClanPowerTag()
 end
 
 function DrawClanPowerTag()
@@ -1086,6 +1088,7 @@
 			-- Pay the price
 			clanPower[GetHogClan(CurrentHedgehog)] = clanPower[GetHogClan(CurrentHedgehog)] - placedExpense
 			RenderClanPower()
+			UpdateTeamLabels()
 			if cat[cIndex] == "Girder Placement Mode" or cat[cIndex] == "Rubber Placement Mode" then
 				PlaySound(sndPlaced)
 			end
@@ -1346,6 +1349,10 @@
 
 	HandleStructures()
 
+	if GameTime % 100 == 0 then
+		UpdateTeamLabels()
+	end
+
 	if CurrentHedgehog ~= nil then
 
 		if wallsVisible == true then
@@ -1834,6 +1841,7 @@
 	clanCratesSpawned[clan] = 0
 
 	RenderClanPower()
+	UpdateTeamLabels()
 end
 
 function onEndTurn()