void CvPlayerAI::AI_updateFoundValues(bool bStartingLoc) { int iGoodEnoughToBeWorthOurTime = GC.getAI_STRATEGY_MINIMUM_SETTLE_FERTILITY(); int iLoop; const int iNumPlots = GC.getMap().numPlots(); for(CvArea* pLoopArea = GC.getMap().firstArea(&iLoop); pLoopArea != NULL; pLoopArea = GC.getMap().nextArea(&iLoop)) { pLoopArea->setTotalFoundValue(0); } const PlayerTypes eID = GetID(); if(bStartingLoc) { for(int iI = 0; iI < iNumPlots; iI++) { GC.getMap().plotByIndexUnchecked(iI)->setFoundValue(eID, -1); } } else { const TeamTypes eTeam = getTeam(); GC.getGame().GetSettlerSiteEvaluator()->ComputeFlavorMultipliers(this); for (int iI = 0; iI < iNumPlots; iI++) { CvPlot* pLoopPlot = GC.getMap().plotByIndexUnchecked(iI); if (pLoopPlot->isRevealed(eTeam)) { const int iValue = GC.getGame().GetSettlerSiteEvaluator()->PlotFoundValue(pLoopPlot, this, NO_YIELD, false); pLoopPlot->setFoundValue(eID, iValue); if (iValue >= iGoodEnoughToBeWorthOurTime) { CvArea* pLoopArea = GC.getMap().getArea(pLoopPlot->getArea()); if(pLoopArea && !pLoopArea->isWater()) { pLoopArea->setTotalFoundValue(pLoopArea->getTotalFoundValue() + iValue); } } } else { pLoopPlot->setFoundValue(eID, -1); } } } }
void CvPlayerAI::AI_updateFoundValues(bool bStartingLoc) { int iLoop; const int iNumPlots = GC.getMap().numPlots(); for(CvArea *pLoopArea = GC.getMap().firstArea(&iLoop); pLoopArea != NULL; pLoopArea = GC.getMap().nextArea(&iLoop)) { pLoopArea->setTotalFoundValue(0); } const PlayerTypes eID = GetID(); if (bStartingLoc) { for (int iI = 0; iI < iNumPlots; iI++) { GC.getMap().plotByIndexUnchecked(iI)->setFoundValue(eID, -1); } } else { const TeamTypes eTeam = getTeam(); for (int iI = 0; iI < iNumPlots; iI++) { CvPlot* pLoopPlot = GC.getMap().plotByIndexUnchecked(iI); if (pLoopPlot->isRevealed(eTeam)) { const int iValue = AI_foundValue(pLoopPlot->getX(), pLoopPlot->getY()); pLoopPlot->setFoundValue(eID, iValue); CvArea *pLoopArea = GC.getMap().getArea(pLoopPlot->getArea()); if (pLoopArea && !pLoopArea->isWater()) { pLoopArea->setTotalFoundValue(pLoopArea->getTotalFoundValue() + iValue); } } else { pLoopPlot->setFoundValue(eID, -1); } } } }