Bazaar developer reference

CvPlayer::ChangeSpecialistCultureChange(int)

Defined in
CvPlayer.cpp, line 10736
Class
CvPlayer
Hook name
CivHooks::CvPlayer_ChangeSpecialistCultureChange

Hooks

static bool BeforeCvPlayer_ChangeSpecialistCultureChange(CvPlayer* self, int iChange);static void AfterCvPlayer_ChangeSpecialistCultureChange(CvPlayer* self, int iChange);static void ReplaceCvPlayer_ChangeSpecialistCultureChange(void (*original)(CvPlayer*, int), CvPlayer* self, int iChange);CivRegisterBefore<CivHooks::CvPlayer_ChangeSpecialistCultureChange>(host, &BeforeCvPlayer_ChangeSpecialistCultureChange);CivRegisterAfter<CivHooks::CvPlayer_ChangeSpecialistCultureChange>(host, &AfterCvPlayer_ChangeSpecialistCultureChange);CivRegisterReplace<CivHooks::CvPlayer_ChangeSpecialistCultureChange>(host, &ReplaceCvPlayer_ChangeSpecialistCultureChange);

Code

10735/// Specialist Culture Modifier10736void CvPlayer::ChangeSpecialistCultureChange(int iChange)10737{10738	if(iChange != 0)10739	{10740		CvCity* pLoopCity;10741		int iLoop;1074210743		int iTotalCulture = 0;1074410745		SpecialistTypes eSpecialist;10746		int iSpecialistLoop;10747		int iSpecialistCount;1074810749		// Undo old culture10750		for(pLoopCity = firstCity(&iLoop); pLoopCity != NULL; pLoopCity = nextCity(&iLoop))10751		{10752			for(iSpecialistLoop = 0; iSpecialistLoop < GC.getNumSpecialistInfos(); iSpecialistLoop++)10753			{10754				eSpecialist = (SpecialistTypes) iSpecialistLoop;10755				iSpecialistCount = pLoopCity->GetCityCitizens()->GetSpecialistCount(eSpecialist);10756				iTotalCulture += (iSpecialistCount * pLoopCity->GetCultureFromSpecialist(eSpecialist));10757			}1075810759			pLoopCity->ChangeJONSCulturePerTurnFromSpecialists(-iTotalCulture);10760		}1076110762		// CHANGE VALUE10763		m_iSpecialistCultureChange += iChange;1076410765		iTotalCulture = 0;1076610767		// Apply new culture10768		for(pLoopCity = firstCity(&iLoop); pLoopCity != NULL; pLoopCity = nextCity(&iLoop))10769		{10770			for(iSpecialistLoop = 0; iSpecialistLoop < GC.getNumSpecialistInfos(); iSpecialistLoop++)10771			{10772				eSpecialist = (SpecialistTypes) iSpecialistLoop;10773				iSpecialistCount = pLoopCity->GetCityCitizens()->GetSpecialistCount(eSpecialist);10774				iTotalCulture += (iSpecialistCount * pLoopCity->GetCultureFromSpecialist(eSpecialist));10775			}1077610777			pLoopCity->ChangeJONSCulturePerTurnFromSpecialists(iTotalCulture);10778		}10779	}10780}

Calls

Called by