CvCity::canHurryUnit(HurryTypes, UnitTypes, bool) const
- Defined in
- CvCity.cpp, line 5997
- Class
- CvCity
- Hook name
CivHooks::CvCity_canHurryUnit
Hooks
static bool BeforeCvCity_canHurryUnit(const CvCity* self, HurryTypes eHurry, UnitTypes eUnit, bool bIgnoreNew, bool& result);static void AfterCvCity_canHurryUnit(const CvCity* self, HurryTypes eHurry, UnitTypes eUnit, bool bIgnoreNew, bool& result);static bool ReplaceCvCity_canHurryUnit(bool (*original)(const CvCity*, HurryTypes, UnitTypes, bool), const CvCity* self, HurryTypes eHurry, UnitTypes eUnit, bool bIgnoreNew);CivRegisterBefore<CivHooks::CvCity_canHurryUnit>(host, &BeforeCvCity_canHurryUnit);CivRegisterAfter<CivHooks::CvCity_canHurryUnit>(host, &AfterCvCity_canHurryUnit);CivRegisterReplace<CivHooks::CvCity_canHurryUnit>(host, &ReplaceCvCity_canHurryUnit);
Code
5997bool CvCity::canHurryUnit(HurryTypes eHurry, UnitTypes eUnit, bool bIgnoreNew) const5998{5999 VALIDATE_OBJECT6000 if(!(GET_PLAYER(getOwner()).IsHasAccessToHurry(eHurry)))6001 {6002 return false;6003 }60046005 if(getUnitProduction(eUnit) >= getProductionNeeded(eUnit))6006 {6007 return false;6008 }60096010 if(GET_PLAYER(getOwner()).GetTreasury()->GetGold() < getHurryGold(eHurry, getHurryCost(eHurry, false, eUnit, bIgnoreNew), getProductionNeeded(eUnit)))6011 {6012 return false;6013 }60146015 if(maxHurryPopulation() < getHurryPopulation(eHurry, getHurryCost(eHurry, true, eUnit, bIgnoreNew)))6016 {6017 return false;6018 }60196020 return true;6021}
Calls
- CvCity::getHurryCost(HurryTypes, bool, UnitTypes, bool) const
- CvCity::getHurryGold(HurryTypes, int, int) const
- CvCity::getHurryPopulation(HurryTypes, int) const
- CvCity::getOwner() const
- CvCity::getProductionNeeded(UnitTypes) const
- CvCity::getUnitProduction(UnitTypes) const
- CvCity::maxHurryPopulation() const
- CvPlayer::GetTreasury() const
- CvPlayer::IsHasAccessToHurry(HurryTypes) const
- CvPlayerAI::getPlayer(PlayerTypes)
- CvTreasury::GetGold() const