Don't count dead sides for the end-game advantage

This commit is contained in:
Alexander van Gessel 2012-03-18 02:43:31 +01:00
parent fba24f7ca0
commit 4173462368

View File

@ -101,6 +101,22 @@
if team.__cfg.hidden then
break
end
local r, g, b = 255, 255, 255
if team.__cfg.color == 1 then r, g, b = 255, 0, 0
elseif team.__cfg.color == 2 then r, g, b = 0, 0, 255
elseif team.__cfg.color == 3 then r, g, b = 0, 255, 0
elseif team.__cfg.color == 4 then r, g, b = 155, 48, 255
elseif team.__cfg.color == 5 then r, g, b = 0, 0, 0
elseif team.__cfg.color == 6 then r, g, b = 165, 42, 42
elseif team.__cfg.color == 7 then r, g, b = 255, 165, 0
elseif team.__cfg.color == 8 then r, g, b = 255, 255, 255
elseif team.__cfg.color == 9 then r, g, b = 0, 128, 128 end
if # wesnoth.get_units( { side = side } ) == 0 then
side_comparison = side_comparison ..
string.format( tostring( _ "<span strikethrough='true' foreground='#%02x%02x%02x'>Side %d</span>") .. "\n",
r, g, b, side)
break
end
local income = team.total_income * income_factor
local units = 0
-- Calc the total unit-score here
@ -112,16 +128,6 @@
end
-- Up to here
local total = units + team.gold + income
local r, g, b = 255, 255, 255
if team.__cfg.color == 1 then r, g, b = 255, 0, 0
elseif team.__cfg.color == 2 then r, g, b = 0, 0, 255
elseif team.__cfg.color == 3 then r, g, b = 0, 255, 0
elseif team.__cfg.color == 4 then r, g, b = 155, 48, 255
elseif team.__cfg.color == 5 then r, g, b = 0, 0, 0
elseif team.__cfg.color == 6 then r, g, b = 165, 42, 42
elseif team.__cfg.color == 7 then r, g, b = 255, 165, 0
elseif team.__cfg.color == 8 then r, g, b = 255, 255, 255
elseif team.__cfg.color == 9 then r, g, b = 0, 128, 128 end
side_comparison = side_comparison ..
string.format( tostring( _ "<span foreground='#%02x%02x%02x'>Side %d</span>: Income score = %d Unit score = %d Gold = %d") .. "\n" .. tostring( _ "Grand total: <b>%d</b>") .. "\n",
r, g, b, side, income, units, team.gold, total)