# HG changeset patch
# User Wuzzy <Wuzzy2@mail.ru>
# Date 1543520260 -3600
# Node ID ffebbcc40c9b9e11dc5c81bf574b3f9d49c52080
# Parent  1dcc37b6913eeb72df6997582b2854212ca81e0b
Construction Mode: Update team labels more reliably

diff -r 1dcc37b6913e -r ffebbcc40c9b 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()