Ticket #3525: t3525_always_compute_territory_v1.patch

File t3525_always_compute_territory_v1.patch, 753 bytes (added by elexis, 9 years ago)

CalculateTerritories(); is called in CCmpTerritoryManager::ComputeBoundaries, CCmpTerritoryManager::GetOwner, CCmpTerritoryManager::GetNeighbours, CCmpTerritoryManager::IsConnected, CCmpTerritoryManager::SetTerritoryBlinking and GetTerritoryGrid. So calling it there too is consistent and also fixes the bug.

  • source/simulation2/components/CCmpTerritoryManager.cpp

    std::vector<STerritoryBoundary> CCmpTerr  
    535535u8 CCmpTerritoryManager::GetTerritoryPercentage(player_id_t player)
    536536{
    537537    if (player <= 0 || (size_t)player > m_TerritoryCellCounts.size())
    538538        return 0;
    539539
    540     if (m_TerritoryTotalPassableCellCount == 0)
    541         CalculateTerritories();
     540    CalculateTerritories();
    542541
    543542    if (m_TerritoryTotalPassableCellCount == 0)
    544543        return 0;
    545544
    546545    u8 percentage = (m_TerritoryCellCounts[player] * 100) / m_TerritoryTotalPassableCellCount;