CvCitySiteEvaluator::ComputeStrategicValue(CvPlot *, CvPlayer *, int)
- Defined in
- CvSiteEvaluationClasses.cpp, line 1046
- Class
- CvCitySiteEvaluator
- Hook name
CivHooks::CvCitySiteEvaluator_ComputeStrategicValue
Hooks
static bool BeforeCvCitySiteEvaluator_ComputeStrategicValue(CvCitySiteEvaluator* self, CvPlot* pPlot, CvPlayer* pPlayer, int iPlotsFromCity, int& result);static void AfterCvCitySiteEvaluator_ComputeStrategicValue(CvCitySiteEvaluator* self, CvPlot* pPlot, CvPlayer* pPlayer, int iPlotsFromCity, int& result);static int ReplaceCvCitySiteEvaluator_ComputeStrategicValue(int (*original)(CvCitySiteEvaluator*, CvPlot*, CvPlayer*, int), CvCitySiteEvaluator* self, CvPlot* pPlot, CvPlayer* pPlayer, int iPlotsFromCity);CivRegisterBefore<CivHooks::CvCitySiteEvaluator_ComputeStrategicValue>(host, &BeforeCvCitySiteEvaluator_ComputeStrategicValue);CivRegisterAfter<CivHooks::CvCitySiteEvaluator_ComputeStrategicValue>(host, &AfterCvCitySiteEvaluator_ComputeStrategicValue);CivRegisterReplace<CivHooks::CvCitySiteEvaluator_ComputeStrategicValue>(host, &ReplaceCvCitySiteEvaluator_ComputeStrategicValue);
Code
1045/// Value of plot for providing strategic value1046int CvCitySiteEvaluator::ComputeStrategicValue(CvPlot* pPlot, CvPlayer* pPlayer, int iPlotsFromCity)1047{1048 int rtnValue = 0;10491050 CvAssert(pPlot);1051 if(!pPlot) return rtnValue;10521053 // Possible chokepoint if impassable terrain and exactly 2 plots from city1054 if(iPlotsFromCity == 2 && (pPlot->isImpassable() || pPlot->isMountain()))1055 {1056 rtnValue += /*5*/ GC.getCHOKEPOINT_STRATEGIC_VALUE();1057 }10581059 // Hills in first ring are useful for defense and production1060 if(iPlotsFromCity == 1 && pPlot->isHills())1061 {1062 rtnValue += /*3*/ GC.getHILL_STRATEGIC_VALUE();1063 }10641065 // Some Features are less attractive to settle in, (e.g. Jungles, since it takes a while before you can clear them and they slow down movement)1066 if(pPlot->getFeatureType() != NO_FEATURE)1067 {1068 int iWeight = GC.getFeatureInfo(pPlot->getFeatureType())->getStartingLocationWeight();1069 if(iWeight != 0 && iPlotsFromCity == 1)1070 {1071 rtnValue += iWeight;1072 }1073 }10741075 // Nearby City1076 if(pPlayer != NULL && pPlot->isCity())1077 {1078// if (pPlot->getOwner() == pPlayer->getID())1079 {1080 rtnValue += /*-1000*/ GC.getALREADY_OWNED_STRATEGIC_VALUE();1081 }1082 }10831084 // POSSIBLE FUTURE: Is there any way for us to know to grab land between us and another major civ?10851086 rtnValue *= m_iFlavorMultiplier[SITE_EVALUATION_STRATEGIC];10871088 return rtnValue;1089}
Calls
- CvFeatureInfo::getStartingLocationWeight() const
- CvGlobals::getALREADY_OWNED_STRATEGIC_VALUE()
- CvGlobals::getCHOKEPOINT_STRATEGIC_VALUE()
- CvGlobals::getFeatureInfo(FeatureTypes)
- CvGlobals::getHILL_STRATEGIC_VALUE()
- CvPlot::getFeatureType() const
- CvPlot::isCity() const
- CvPlot::isHills() const
- CvPlot::isImpassable() const
- CvPlot::isMountain() const