Hooks
static bool BeforeCvPlayer_IsCanPurchaseAnyCity(CvPlayer* self, bool bTestPurchaseCost, bool bTestTrainable, UnitTypes eUnit, BuildingTypes eBuilding, YieldTypes ePurchaseYield, bool& result);static void AfterCvPlayer_IsCanPurchaseAnyCity(CvPlayer* self, bool bTestPurchaseCost, bool bTestTrainable, UnitTypes eUnit, BuildingTypes eBuilding, YieldTypes ePurchaseYield, bool& result);static bool ReplaceCvPlayer_IsCanPurchaseAnyCity(bool (*original)(CvPlayer*, bool, bool, UnitTypes, BuildingTypes, YieldTypes), CvPlayer* self, bool bTestPurchaseCost, bool bTestTrainable, UnitTypes eUnit, BuildingTypes eBuilding, YieldTypes ePurchaseYield);CivRegisterBefore<CivHooks::CvPlayer_IsCanPurchaseAnyCity>(host, &BeforeCvPlayer_IsCanPurchaseAnyCity);CivRegisterAfter<CivHooks::CvPlayer_IsCanPurchaseAnyCity>(host, &AfterCvPlayer_IsCanPurchaseAnyCity);CivRegisterReplace<CivHooks::CvPlayer_IsCanPurchaseAnyCity>(host, &ReplaceCvPlayer_IsCanPurchaseAnyCity);
Code
8486/// Can we purchase this unit or building in any of our cities?8487bool CvPlayer::IsCanPurchaseAnyCity(bool bTestPurchaseCost, bool bTestTrainable, UnitTypes eUnit, BuildingTypes eBuilding, YieldTypes ePurchaseYield)8488{8489 int iLoop;8490 CvCity *pLoopCity;84918492 for (pLoopCity = firstCity(&iLoop); pLoopCity != NULL; pLoopCity = nextCity(&iLoop))8493 {8494 if (pLoopCity->IsCanPurchase(bTestPurchaseCost, bTestTrainable, eUnit, eBuilding, NO_PROJECT, ePurchaseYield))8495 {8496 return true;8497 }8498 }84998500 return false;8501}