CvPlayer::canFound(int, int, bool) const
- Defined in
- CvPlayer.cpp, line 7492
- Class
- CvPlayer
- Hook name
CivHooks::CvPlayer_canFound- Lua events
GameEvents.PlayerCanFoundCityRegardless
Hooks
static bool BeforeCvPlayer_canFound(const CvPlayer* self, int iX, int iY, bool bTestVisible, bool& result);static void AfterCvPlayer_canFound(const CvPlayer* self, int iX, int iY, bool bTestVisible, bool& result);static bool ReplaceCvPlayer_canFound(bool (*original)(const CvPlayer*, int, int, bool), const CvPlayer* self, int iX, int iY, bool bTestVisible);CivRegisterBefore<CivHooks::CvPlayer_canFound>(host, &BeforeCvPlayer_canFound);CivRegisterAfter<CivHooks::CvPlayer_canFound>(host, &AfterCvPlayer_canFound);CivRegisterReplace<CivHooks::CvPlayer_canFound>(host, &ReplaceCvPlayer_canFound);
Code
7492bool CvPlayer::canFound(int iX, int iY, bool bTestVisible) const7493{7494 CvPlot* pPlot;74957496 pPlot = GC.getMap().plot(iX, iY);74977498#if defined(MOD_EVENTS_CITY_FOUNDING)7499 if (MOD_EVENTS_CITY_FOUNDING) {7500 if (GAMEEVENTINVOKE_TESTANY(GAMEEVENT_PlayerCanFoundCityRegardless, GetID(), iX, iY) == GAMEEVENTRETURN_TRUE) {7501 return true;7502 }7503 }7504#endif75057506 // Has the AI agreed to not settle here?7507 if(!isMinorCiv() && !isBarbarian())7508 {7509 if(pPlot->IsNoSettling(GetID()))7510 return false;7511 }75127513 // Haxor for Venice to prevent secondary founding7514 if (GetPlayerTraits()->IsNoAnnexing() && getCapitalCity())7515 {7516 return false;7517 }75187519 // Settlers cannot found cities while empire is very unhappy7520 if(!bTestVisible)7521 {7522 if(IsEmpireVeryUnhappy())7523 return false;7524 }75257526 return GC.getGame().GetSettlerSiteEvaluator()->CanFound(pPlot, this, bTestVisible);7527}
Calls
- CustomMods::eventTestAny(const char *, const char *, ...)
- CustomMods::isEVENTS_CITY_FOUNDING()
- CvCitySiteEvaluator::CanFound(CvPlot *, const CvPlayer *, bool) const
- CvGame::GetSettlerSiteEvaluator()
- CvGlobals::getGame()
- CvGlobals::getMap()
- CvMap::plot(int, int) const
- CvPlayer::getCapitalCity() const
- CvPlayer::GetID() const
- CvPlayer::GetPlayerTraits() const
- CvPlayer::isBarbarian() const
- CvPlayer::IsEmpireVeryUnhappy() const
- CvPlayer::isMinorCiv() const
- CvPlayerTraits::IsNoAnnexing() const
- CvPlot::IsNoSettling(PlayerTypes) const