Bazaar developer reference

CvPlayer::changeHurryCount(HurryTypes, int)

Defined in
CvPlayer.cpp, line 20818
Class
CvPlayer
Hook name
CivHooks::CvPlayer_changeHurryCount

Hooks

static bool BeforeCvPlayer_changeHurryCount(CvPlayer* self, HurryTypes eIndex, int iChange);static void AfterCvPlayer_changeHurryCount(CvPlayer* self, HurryTypes eIndex, int iChange);static void ReplaceCvPlayer_changeHurryCount(void (*original)(CvPlayer*, HurryTypes, int), CvPlayer* self, HurryTypes eIndex, int iChange);CivRegisterBefore<CivHooks::CvPlayer_changeHurryCount>(host, &BeforeCvPlayer_changeHurryCount);CivRegisterAfter<CivHooks::CvPlayer_changeHurryCount>(host, &AfterCvPlayer_changeHurryCount);CivRegisterReplace<CivHooks::CvPlayer_changeHurryCount>(host, &ReplaceCvPlayer_changeHurryCount);

Code

20818void CvPlayer::changeHurryCount(HurryTypes eIndex, int iChange)20819{20820	CvAssert(eIndex >= 0);20821	CvAssert(eIndex < GC.getNumHurryInfos());2082220823	int oldHurryCount = m_paiHurryCount[eIndex];20824	m_paiHurryCount.setAt(eIndex, m_paiHurryCount[eIndex] + iChange);20825	CvAssert(getHurryCount(eIndex) >= 0);2082620827	CvHurryInfo* pkHurryInfo = GC.getHurryInfo(eIndex);20828	if(pkHurryInfo == NULL)20829		return;2083020831	// if we just went from 0 to 1 (or the reverse)20832	if((oldHurryCount > 0) != (m_paiHurryCount[eIndex] > 0))20833	{20834		// does this hurry reduce population?20835		if(pkHurryInfo->getProductionPerPopulation() > 0)20836		{20837			m_iPopRushHurryCount += iChange;20838			CvAssert(m_iPopRushHurryCount >= 0);20839		}20840	}20841}

Calls

Called by