CvPlayer::GetHurryGoldCost(HurryTypes) const
- Defined in
- CvPlayer.cpp, line 20730
- Class
- CvPlayer
- Hook name
CivHooks::CvPlayer_GetHurryGoldCost
Hooks
static bool BeforeCvPlayer_GetHurryGoldCost(const CvPlayer* self, HurryTypes eHurry, int& result);static void AfterCvPlayer_GetHurryGoldCost(const CvPlayer* self, HurryTypes eHurry, int& result);static int ReplaceCvPlayer_GetHurryGoldCost(int (*original)(const CvPlayer*, HurryTypes), const CvPlayer* self, HurryTypes eHurry);CivRegisterBefore<CivHooks::CvPlayer_GetHurryGoldCost>(host, &BeforeCvPlayer_GetHurryGoldCost);CivRegisterAfter<CivHooks::CvPlayer_GetHurryGoldCost>(host, &AfterCvPlayer_GetHurryGoldCost);CivRegisterReplace<CivHooks::CvPlayer_GetHurryGoldCost>(host, &ReplaceCvPlayer_GetHurryGoldCost);
Code
20729/// How much Gold does it cost us to Hurry? (whatever the applicable item is)20730int CvPlayer::GetHurryGoldCost(HurryTypes eHurry) const20731{20732 int iGold = -1;2073320734 CvHurryInfo* pkHurryInfo = GC.getHurryInfo(eHurry);20735 if(pkHurryInfo == NULL)20736 {20737 //This should never happen.20738 return -1;20739 }2074020741 // Science Rushing20742 if(pkHurryInfo->getGoldPerBeaker() > 0)20743 {20744 TechTypes eTech = GetPlayerTechs()->GetCurrentResearch();2074520746 if(eTech != NO_TECH)20747 {20748 int iTotalCost = GET_TEAM(getTeam()).GetTeamTechs()->GetResearchCost(eTech);20749 int iResearchLeft = GET_TEAM(getTeam()).GetTeamTechs()->GetResearchLeft(eTech);2075020751 // Cost of Gold rushing based on the ORIGINAL Research price20752 int iGoldForFullPrice = iTotalCost * pkHurryInfo->getGoldPerBeaker();20753 iGoldForFullPrice = (int) pow((double) iGoldForFullPrice, (double) /*1.10f*/ GC.getHURRY_GOLD_TECH_EXPONENT());2075420755 // Figure out the actual cost by comparing what's left to the original Research cost, and multiplying that by the amount to Gold rush the original cost20756 iGold = (iGoldForFullPrice * iResearchLeft / iTotalCost);20757 }20758 }2075920760 // Culture Rushing20761 if(pkHurryInfo->getGoldPerCulture() > 0)20762 {20763 int iCurrentPolicyCost = getNextPolicyCost();2076420765 if(iCurrentPolicyCost > 0)20766 {20767 int iCultureLeft = iCurrentPolicyCost - getJONSCulture();2076820769 // Cost of Gold rushing based on the ORIGINAL Culture price20770 int iGoldForFullPrice = iCurrentPolicyCost * pkHurryInfo->getGoldPerCulture();20771 iGoldForFullPrice = (int) pow((double) iGoldForFullPrice, (double) /*1.10f*/ GC.getHURRY_GOLD_CULTURE_EXPONENT());2077220773 // Figure out the actual cost by comparing what's left to the original Culture cost, and multiplying that by the amount to Gold rush the original cost20774 iGold = (iGoldForFullPrice * iCultureLeft / iCurrentPolicyCost);20775 }20776 }2077720778 return iGold;20779}
Calls
- CvGlobals::getHURRY_GOLD_CULTURE_EXPONENT()
- CvGlobals::getHURRY_GOLD_TECH_EXPONENT()
- CvGlobals::getHurryInfo(HurryTypes)
- CvHurryInfo::getGoldPerBeaker() const
- CvHurryInfo::getGoldPerCulture() const
- CvPlayer::getJONSCulture() const
- CvPlayer::getNextPolicyCost() const
- CvPlayer::GetPlayerTechs() const
- CvPlayer::getTeam() const
- CvPlayerTechs::GetCurrentResearch() const
- CvTeam::getTeam(TeamTypes)
- CvTeam::GetTeamTechs() const
- CvTeamTechs::GetResearchCost(TechTypes) const
- CvTeamTechs::GetResearchLeft(TechTypes) const
pow