/// Fill the map with data for this AI player's turn
void CvTacticalAnalysisMap::RefreshDataForNextPlayer(CvPlayer* pPlayer)
{
	if(m_pPlots)
	{
		if(pPlayer != m_pPlayer || m_iTurnBuilt < GC.getGame().getGameTurn())
		{
			m_pPlayer = pPlayer;
			m_iTurnBuilt = GC.getGame().getGameTurn();
			m_iTacticalRange = ((GC.getAI_TACTICAL_RECRUIT_RANGE() + GC.getGame().getCurrentEra()) * 2) / 3;  // Have this increase as game goes on
			m_iUnitStrengthMultiplier = GC.getAI_TACTICAL_MAP_UNIT_STRENGTH_MULTIPLIER() * m_iTacticalRange;

			AI_PERF_FORMAT("AI-perf.csv", ("Tactical Analysis Map, Turn %d, %s", GC.getGame().getGameTurn(), m_pPlayer->getCivilizationShortDescription()) );

			m_bIsBuilt = false;

			// AI civs build this map every turn
			//if (!m_pPlayer->isHuman() && !m_pPlayer->isBarbarian())
			if(!m_pPlayer->isBarbarian())
			{
				m_DominanceZones.clear();

				AddTemporaryZones();

				for(int iI = 0; iI < GC.getMap().numPlots(); iI++)
				{
					CvAssertMsg((iI < m_iNumPlots), "Plot to be accessed exceeds allocation!");

					CvPlot* pPlot = GC.getMap().plotByIndexUnchecked(iI);
					if(pPlot == NULL)
					{
						// Erase this cell
						m_pPlots[iI].Clear();
					}
					else
					{
						if(PopulateCell(iI, pPlot))
						{
							AddToDominanceZones(iI, &m_pPlots[iI]);
						}
					}
				}

				CalculateMilitaryStrengths();
				PrioritizeZones();
				LogZones();
				BuildEnemyUnitList();
				MarkCellsNearEnemy();

				m_bIsBuilt = true;
			}
		}
	}
}
/// Fill the map with data for this AI player's turn
void CvTacticalAnalysisMap::Refresh()
{
	if(!IsUpToDate())
	{
		//can happen in the first turn ...
		if (m_pCells.size()!=GC.getMap().numPlots())
			Init(m_ePlayer);

		m_iTurnBuilt = GC.getGame().getGameTurn();
		m_iTacticalRange = ((GC.getAI_TACTICAL_RECRUIT_RANGE() + GC.getGame().getCurrentEra()) * 3) / 5;  // Have this increase as game goes on
		m_iUnitStrengthMultiplier = GC.getAI_TACTICAL_MAP_UNIT_STRENGTH_MULTIPLIER() * m_iTacticalRange;

		AI_PERF_FORMAT("AI-perf.csv", ("Tactical Analysis Map, Turn %d, %s", GC.getGame().getGameTurn(), m_pPlayer->getCivilizationShortDescription()) );

		m_DominanceZones.clear();
		AddTemporaryZones();

		for(int iI = 0; iI < GC.getMap().numPlots(); iI++)
		{
			CvAssertMsg((iI < m_iNumPlots), "Plot to be accessed exceeds allocation!");

			CvPlot* pPlot = GC.getMap().plotByIndexUnchecked(iI);
			if(pPlot == NULL)
			{
				// Erase this cell
				m_pCells[iI].Clear();
			}
			else
			{
				if(PopulateCell(iI, pPlot))
				{
					AddToDominanceZones(iI, &m_pCells[iI]);
				}
			}
		}

		//barbarians don't care about tactical dominance
		if(m_ePlayer!=BARBARIAN_PLAYER)
		{
			EstablishZoneNeighborhood();
			CalculateMilitaryStrengths();
			PrioritizeZones();
			LogZones();
		}

		BuildEnemyUnitList();
		MarkCellsNearEnemy();
	}
}