Add check for non-passable (likely water-only) maps to territory percentage calculation.

Patch by s0600204. Fixes #3407.

This was SVN commit r17002.
This commit is contained in:
leper 2015-09-11 02:16:21 +00:00
parent 7842aa0468
commit fc051d94cc

View File

@ -540,7 +540,9 @@ u8 CCmpTerritoryManager::GetTerritoryPercentage(player_id_t player)
if (m_TerritoryTotalPassableCellCount == 0)
CalculateTerritories();
ENSURE(m_TerritoryTotalPassableCellCount > 0);
if (m_TerritoryTotalPassableCellCount == 0)
return 0;
u8 percentage = (m_TerritoryCellCounts[player] * 100) / m_TerritoryTotalPassableCellCount;
ENSURE(percentage <= 100);
return percentage;