CvPlot::IsHomeFrontForPlayer(PlayerTypes) const
- Defined in
- CvPlot.cpp, line 5769
- Class
- CvPlot
- Hook name
CivHooks::CvPlot_IsHomeFrontForPlayer
Hooks
static bool BeforeCvPlot_IsHomeFrontForPlayer(const CvPlot* self, PlayerTypes ePlayer, bool& result);static void AfterCvPlot_IsHomeFrontForPlayer(const CvPlot* self, PlayerTypes ePlayer, bool& result);static bool ReplaceCvPlot_IsHomeFrontForPlayer(bool (*original)(const CvPlot*, PlayerTypes), const CvPlot* self, PlayerTypes ePlayer);CivRegisterBefore<CivHooks::CvPlot_IsHomeFrontForPlayer>(host, &BeforeCvPlot_IsHomeFrontForPlayer);CivRegisterAfter<CivHooks::CvPlot_IsHomeFrontForPlayer>(host, &AfterCvPlot_IsHomeFrontForPlayer);CivRegisterReplace<CivHooks::CvPlot_IsHomeFrontForPlayer>(host, &ReplaceCvPlot_IsHomeFrontForPlayer);
Code
5768/// Is this Plot within a certain range of any of a player's Cities?5769bool CvPlot::IsHomeFrontForPlayer(PlayerTypes ePlayer) const5770{5771 // Owned?5772 if(isOwned())5773 {5774 if(getOwner() == ePlayer)5775 {5776 return true;5777 }5778 }57795780 CvCity* pLoopCity;5781 int iCityLoop;57825783 int iRange = GC.getAI_DIPLO_PLOT_RANGE_FROM_CITY_HOME_FRONT();57845785 // Not owned by this player, so we have to check things the hard way, and see how close the Plot is to any of this Player's Cities5786 for(pLoopCity = GET_PLAYER(ePlayer).firstCity(&iCityLoop); pLoopCity != NULL; pLoopCity = GET_PLAYER(ePlayer).nextCity(&iCityLoop))5787 {5788 if(::plotDistance(getX(), getY(), pLoopCity->getX(), pLoopCity->getY()) < iRange)5789 {5790 return true;5791 }5792 }57935794 return false;5795}
Calls
- CvCity::getX() const
- CvCity::getY() const
- CvGlobals::getAI_DIPLO_PLOT_RANGE_FROM_CITY_HOME_FRONT()
- CvPlayer::firstCity(int *, bool)
- CvPlayer::nextCity(int *, bool)
- CvPlayerAI::getPlayer(PlayerTypes)
- CvPlot::getOwner() const
- CvPlot::getX() const
- CvPlot::getY() const
- CvPlot::isOwned() const
- plotDistance(int, int, int, int)