# HG changeset patch # User Wuzzy # Date 1558050937 -7200 # Node ID 851f1687439de36858fbdb60a0de5c67a99beb05 # Parent 6e17abf7b8ef84342ec5aaca74725a2aab8ddf55 Control (style): Implement proper ranking screen and score graph diff -r 6e17abf7b8ef -r 851f1687439d share/hedgewars/Data/Maps/Control/map.lua --- a/share/hedgewars/Data/Maps/Control/map.lua Fri May 17 01:16:14 2019 +0200 +++ b/share/hedgewars/Data/Maps/Control/map.lua Fri May 17 01:55:37 2019 +0200 @@ -178,10 +178,15 @@ end end - -- Update team labels + -- Update team labels and graph + local clanGraphPointWritten = {} for i = 0,(TeamsCount-1) do if teamNameArr[i] ~= " " then SetTeamLabel(teamNameArr[i], teamScore[teamClan[i]]) + if not clanGraphPointWritten[teamClan[i]] then + SendStat(siClanHealth, teamScore[teamClan[i]], teamNameArr[i]) + clanGraphPointWritten[teamClan[i]] = true + end end end @@ -275,6 +280,9 @@ WaterRise = 0 HealthDecrease = 0 + SendHealthStatsOff() + SendRankingStatsOff() + end @@ -371,7 +379,26 @@ end end end - SetTurnTimeLeft(1) + EndTurn(true) + + -- Rankings + local teamList = {} + for i=0, TeamsCount-1 do + local name = GetTeamName(i) + local clan = GetTeamClan(name) + table.insert(teamList, { score = teamScore[teamClan[i]], name = name, clan = clan }) + end + local teamRank = function(a, b) + return a.score > b.score + end + table.sort(teamList, teamRank) + + for i=1, #teamList do + SendStat(siPointType, "!POINTS") + SendStat(siPlayerKills, tostring(teamList[i].score), teamList[i].name) + end + SendStat(siGraphTitle, loc("Score graph")) + end end