CvPlayer::getWorkPlotDistance() const
- Defined in
- CvPlayer.cpp, line 3398
- Class
- CvPlayer
- Hook name
CivHooks::CvPlayer_getWorkPlotDistance
Hooks
static bool BeforeCvPlayer_getWorkPlotDistance(const CvPlayer* self, int& result);static void AfterCvPlayer_getWorkPlotDistance(const CvPlayer* self, int& result);static int ReplaceCvPlayer_getWorkPlotDistance(int (*original)(const CvPlayer*), const CvPlayer* self);CivRegisterBefore<CivHooks::CvPlayer_getWorkPlotDistance>(host, &BeforeCvPlayer_getWorkPlotDistance);CivRegisterAfter<CivHooks::CvPlayer_getWorkPlotDistance>(host, &AfterCvPlayer_getWorkPlotDistance);CivRegisterReplace<CivHooks::CvPlayer_getWorkPlotDistance>(host, &ReplaceCvPlayer_getWorkPlotDistance);
Code
3397/// How far out this player may work plots3398int CvPlayer::getWorkPlotDistance() const3399{3400 int iDistance = GC.getMAXIMUM_WORK_PLOT_DISTANCE();3401 3402#if defined(MOD_TRAITS_CITY_WORKING) || defined(MOD_BUILDINGS_CITY_WORKING) || defined(MOD_POLICIES_CITY_WORKING)3403 // Change distance based on traits, policies, wonders, etc3404 iDistance += GetCityWorkingChange();3405#endif3406#if defined(MOD_TECHS_CITY_WORKING)3407 // Change distance based on techs, etc3408 iDistance += GET_TEAM(getTeam()).GetCityWorkingChange();3409#endif3410 3411 iDistance = std::min(MAX_CITY_RADIUS, std::max(MIN_CITY_RADIUS, iDistance));3412 return iDistance;3413}
Calls
Called by
- CvCity::getWorkPlotDistance(int) const
- CvPlayer::GetNumWorkablePlots() const
- CvPlayer::getBuyPlotDistance() const
- CvCitySiteEvaluator::PlotFoundValue(CvPlot *, CvPlayer *, YieldTypes, bool)
- CvSiteEvaluatorForStart::PlotFoundValue(CvPlot *, CvPlayer *, YieldTypes, bool)
- CvLuaPlayer::lGetWorkPlotDistance(lua_State *)