CvPlayer::IsCanHurry(HurryTypes) const
- Defined in
- CvPlayer.cpp, line 20695
- Class
- CvPlayer
- Hook name
CivHooks::CvPlayer_IsCanHurry
Hooks
static bool BeforeCvPlayer_IsCanHurry(const CvPlayer* self, HurryTypes eIndex, bool& result);static void AfterCvPlayer_IsCanHurry(const CvPlayer* self, HurryTypes eIndex, bool& result);static bool ReplaceCvPlayer_IsCanHurry(bool (*original)(const CvPlayer*, HurryTypes), const CvPlayer* self, HurryTypes eIndex);CivRegisterBefore<CivHooks::CvPlayer_IsCanHurry>(host, &BeforeCvPlayer_IsCanHurry);CivRegisterAfter<CivHooks::CvPlayer_IsCanHurry>(host, &AfterCvPlayer_IsCanHurry);CivRegisterReplace<CivHooks::CvPlayer_IsCanHurry>(host, &ReplaceCvPlayer_IsCanHurry);
Code
20694/// Can we use this Hurry RIGHT NOW?20695bool CvPlayer::IsCanHurry(HurryTypes eIndex) const20696{20697 CvHurryInfo* pkHurryInfo = GC.getHurryInfo(eIndex);20698 if(pkHurryInfo == NULL)20699 return false;2070020701 int iCost = GetHurryGoldCost(eIndex);2070220703 // Can we pay for this Hurry?20704 if(iCost < 0 || GetTreasury()->GetGold() < iCost)20705 {20706 return false;20707 }2070820709 // Science Rushing20710 if(pkHurryInfo->getGoldPerBeaker() > 0)20711 {20712 return true;20713 }2071420715 // Culture Rushing20716 if(pkHurryInfo->getGoldPerCulture() > 0)20717 {20718 // If we already have enough Culture for the next Policy, there's nothing to rush!20719 if(getNextPolicyCost() > getJONSCulture())20720 {20721 return true;20722 }20723 }2072420725 return false;20726}