share/hedgewars/Data/Maps/Control/map.lua
changeset 14990 c52aa7ba2e16
parent 14989 5188ecbf726f
child 15005 1b3d788e7350
equal deleted inserted replaced
14989:5188ecbf726f 14990:c52aa7ba2e16
    51 --------------------------
    51 --------------------------
    52 
    52 
    53 local numhhs = 0 -- store number of hedgehogs
    53 local numhhs = 0 -- store number of hedgehogs
    54 local hhs = {} -- store hedgehog gears
    54 local hhs = {} -- store hedgehog gears
    55 
    55 
    56 local numTeams --  store the number of teams in the game
       
    57 local teamNameArr = {}	-- store the list of teams
    56 local teamNameArr = {}	-- store the list of teams
    58 local teamClan = {}
    57 local teamClan = {}
    59 local teamSize = {}	-- store how many hogs per team
    58 local teamSize = {}	-- store how many hogs per team
    60 local teamIndex = {} -- at what point in the hhs{} does each team begin
    59 local teamIndex = {} -- at what point in the hhs{} does each team begin
    61 
    60 
   203 		teamNameArr[i] = " " -- = i
   202 		teamNameArr[i] = " " -- = i
   204 		teamSize[i] = 0
   203 		teamSize[i] = 0
   205 		teamIndex[i] = 0
   204 		teamIndex[i] = 0
   206 		teamScore[i] = 0
   205 		teamScore[i] = 0
   207 	end
   206 	end
   208 	numTeams = 0
   207 	local numTeams = 0
   209 
   208 
   210 	for i = 0, (numhhs-1) do
   209 	for i = 0, (numhhs-1) do
   211 
   210 
   212 		z = 0
   211 		z = 0
   213 		unfinished = true
   212 		unfinished = true
   234 		end
   233 		end
   235 
   234 
   236 	end
   235 	end
   237 
   236 
   238 	-- find out how many hogs per team, and the index of the first hog in hhs
   237 	-- find out how many hogs per team, and the index of the first hog in hhs
   239 	for i = 0, (numTeams-1) do
   238 	for i = 0, TeamsCount-1 do
   240 		SetTeamLabel(GetTeamName(i), "0")
   239 		SetTeamLabel(GetTeamName(i), "0")
   241 		for z = 0, (numhhs-1) do
   240 		for z = 0, (numhhs-1) do
   242 			if GetHogTeamName(hhs[z]) == teamNameArr[i] then
   241 			if GetHogTeamName(hhs[z]) == teamNameArr[i] then
   243 				teamClan[i] = GetHogClan(hhs[z])
   242 				teamClan[i] = GetHogClan(hhs[z])
   244 				if teamSize[i] == 0 then
   243 				if teamSize[i] == 0 then
   315 	end
   314 	end
   316 
   315 
   317 	--new improved placement schematics aw yeah
   316 	--new improved placement schematics aw yeah
   318 	RebuildTeamInfo()
   317 	RebuildTeamInfo()
   319 
   318 
   320 	for i = 0, (numTeams-1) do
   319 	for i = 0, ClansCount - 1 do
   321 		pointLimit = pointLimit - 25
   320 		pointLimit = pointLimit - 25
   322 	end
   321 	end
   323 
   322 
   324 	missionHelp = loc("Control pillars to score points.") .. "|" ..
   323 	missionHelp = loc("Control pillars to score points.") .. "|" ..
   325 		loc("Hedgehogs will be revived after their death.") .. "|" ..
   324 		loc("Hedgehogs will be revived after their death.") .. "|" ..
   393 		lastTeam = GetHogTeamName(CurrentHedgehog)
   392 		lastTeam = GetHogTeamName(CurrentHedgehog)
   394 	end
   393 	end
   395 
   394 
   396 	if gameWon == false then
   395 	if gameWon == false then
   397 
   396 
   398 		for i = 0, (numTeams-1) do
   397 		for i = 0, TeamsCount - 1 do
   399 			if teamScore[i] >= pointLimit then --150
   398 			if teamScore[i] >= pointLimit then --150
   400 				gameWon = true
   399 				gameWon = true
   401 				winnerClan = i
   400 				winnerClan = i
   402 			end
   401 			end
   403 		end
   402 		end
   413 			end
   412 			end
   414 			EndTurn(true)
   413 			EndTurn(true)
   415 
   414 
   416 			-- Rankings
   415 			-- Rankings
   417 			local teamList = {}
   416 			local teamList = {}
   418 			for i=0, TeamsCount-1 do
   417 			for i=0, TeamsCount - 1 do
   419 				local name = GetTeamName(i)
   418 				local name = GetTeamName(i)
   420 				local clan = GetTeamClan(name)
   419 				local clan = GetTeamClan(name)
   421 				table.insert(teamList, { score = teamScore[teamClan[i]], name = name, clan = clan })
   420 				table.insert(teamList, { score = teamScore[teamClan[i]], name = name, clan = clan })
   422 			end
   421 			end
   423 			RankTeams(teamList)
   422 			RankTeams(teamList)