/// Value of this site for a settler int CvSiteEvaluatorForSettler::PlotFoundValue(CvPlot* pPlot, CvPlayer* pPlayer, YieldTypes eYield, bool bCoastOnly) { CvAssert(pPlot); if(!pPlot) return 0; if(!CanFound(pPlot, pPlayer, true)) { return 0; } // Is there any reason this site doesn't work for a settler? // // First must be on coast if settling a new continent bool bIsCoastal = pPlot->isCoastalLand(GC.getMIN_WATER_SIZE_FOR_OCEAN()); CvArea* pArea = pPlot->area(); CvAssert(pArea); if(!pArea) return 0; int iNumAreaCities = pArea->getCitiesPerPlayer(pPlayer->GetID()); if(bCoastOnly && !bIsCoastal && iNumAreaCities == 0) { return 0; } // Seems okay for a settler, use base class to determine exact value else { return CvCitySiteEvaluator::PlotFoundValue(pPlot, pPlayer, eYield); } }
//------------------------------------------------------------------------------ //int getCitiesPerPlayer(PlayerTypes eIndex); int CvLuaArea::lGetCitiesPerPlayer(lua_State* L) { CvArea* pkArea = GetInstance(L); const PlayerTypes eIndex = (PlayerTypes)lua_tointeger(L, 2); const int iResult = pkArea->getCitiesPerPlayer(eIndex); lua_pushinteger(L, iResult); return 1; }
/// Value of this site for a settler int CvSiteEvaluatorForSettler::PlotFoundValue(CvPlot* pPlot, CvPlayer* pPlayer, YieldTypes eYield, bool bCoastOnly) { CvAssert(pPlot); if(!pPlot) return 0; if(!CanFound(pPlot, pPlayer, true)) { return 0; } // Is there any reason this site doesn't work for a settler? // // First must be on coast if settling a new continent bool bIsCoastal = pPlot->isCoastalLand(GC.getMIN_WATER_SIZE_FOR_OCEAN()); CvArea* pArea = pPlot->area(); CvAssert(pArea); if(!pArea) return 0; int iNumAreaCities = pArea->getCitiesPerPlayer(pPlayer->GetID()); if(bCoastOnly && !bIsCoastal && iNumAreaCities == 0) { return 0; } // Seems okay for a settler, use base class to determine exact value else { // if the civ gets a benefit from settling on a new continent (ie: Indonesia) // double the fertility of that plot int iLuxuryModifier = 0; if (pPlayer->GetPlayerTraits()->WillGetUniqueLuxury(pArea)) { iLuxuryModifier = CvCitySiteEvaluator::PlotFoundValue(pPlot, pPlayer, eYield) * 2; return iLuxuryModifier; } else { return CvCitySiteEvaluator::PlotFoundValue(pPlot, pPlayer, eYield); } } }