Continental supplies: Fix health not being set immediately if skipping continent selection, provoking random continent
authorWuzzy <Wuzzy2@mail.ru>
Mon, 03 Sep 2018 01:48:00 +0200
changeset 13748 d09366ca4d7b
parent 13747 52959f686082
child 13749 0e8db74ec585
Continental supplies: Fix health not being set immediately if skipping continent selection, provoking random continent
share/hedgewars/Data/Scripts/Multiplayer/Continental_supplies.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/Continental_supplies.lua	Mon Sep 03 01:09:14 2018 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Continental_supplies.lua	Mon Sep 03 01:48:00 2018 +0200
@@ -1639,8 +1639,11 @@
 	end
 end
 
-function ShowContinentLabel()
-	if CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)] == 0 then
+function ShowContinentLabel(continent)
+	if not continent then
+		continent = CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]
+	end
+	if continent == 0 then
 		AddCaption(loc("Random continent"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
 	else
 		AddCaption(CS.CONTINENT_INFORMATION[CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]][1], GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmoinfo)
@@ -1682,7 +1685,15 @@
 		CS.SELECT_CONTINENT_CHECK=false
 		EndTurnCS(0)
 		PlaySound(sndPlaced)
-		ShowContinentLabel()
+		if(CurrentHedgehog and CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]==0)
+		then
+			CS.TEAM_CONTINENT[GetHogTeamName(CurrentHedgehog)]=GetRandom(table.maxn(CS.CONTINENT_INFORMATION))+1
+			SetContinentWeapons()
+			HideMission()
+			ShowContinentLabel(0)
+		else
+			ShowContinentLabel()
+		end
 		CS.CONFIRM_CONTINENT_SELECTION = -1
 	end