Bazaar developer reference

CvCityEmphases::SetEmphasize(EmphasizeTypes, bool)

Defined in
CvEmphasisClasses.cpp, line 201
Class
CvCityEmphases
Hook name
CivHooks::CvCityEmphases_SetEmphasize

Hooks

static bool BeforeCvCityEmphases_SetEmphasize(CvCityEmphases* self, EmphasizeTypes eIndex, bool bNewValue);static void AfterCvCityEmphases_SetEmphasize(CvCityEmphases* self, EmphasizeTypes eIndex, bool bNewValue);static void ReplaceCvCityEmphases_SetEmphasize(void (*original)(CvCityEmphases*, EmphasizeTypes, bool), CvCityEmphases* self, EmphasizeTypes eIndex, bool bNewValue);CivRegisterBefore<CivHooks::CvCityEmphases_SetEmphasize>(host, &BeforeCvCityEmphases_SetEmphasize);CivRegisterAfter<CivHooks::CvCityEmphases_SetEmphasize>(host, &AfterCvCityEmphases_SetEmphasize);CivRegisterReplace<CivHooks::CvCityEmphases_SetEmphasize>(host, &ReplaceCvCityEmphases_SetEmphasize);

Code

200/// Turn on this emphasis201void CvCityEmphases::SetEmphasize(EmphasizeTypes eIndex, bool bNewValue)202{203	CvAssertMsg(eIndex >= 0, "eIndex is expected to be non-negative (invalid Index)");204	CvAssertMsg(eIndex < GC.getNumEmphasisInfos(), "eIndex is expected to be within maximum bounds (invalid Index)");205206	if(IsEmphasize(eIndex) != bNewValue)207	{208		m_pbEmphasize[eIndex] = bNewValue;209210		CvEmphasisEntry* pkEmphasis = GC.getEmphasisInfo(eIndex);211212		if(pkEmphasis->IsAvoidGrowth())213		{214			m_iEmphasizeAvoidGrowthCount += ((IsEmphasize(eIndex)) ? 1 : -1);215			CvAssert(GetEmphasizeAvoidGrowthCount() >= 0);216		}217218		if(pkEmphasis->IsGreatPeople())219		{220			m_iEmphasizeGreatPeopleCount += ((IsEmphasize(eIndex)) ? 1 : -1);221		}222223		for(int iI = 0; iI < NUM_YIELD_TYPES; iI++)224		{225			if(pkEmphasis->GetYieldChange(iI))226			{227				m_aiEmphasizeYieldCount[iI] += ((IsEmphasize(eIndex)) ? 1 : -1);228				CvAssert(GetEmphasizeYieldCount((YieldTypes)iI) >= 0);229			}230		}231232		if((m_pCity->getOwner() == GC.getGame().getActivePlayer()) && m_pCity->isCitySelected())233		{234			GC.GetEngineUserInterface()->setDirty(SelectionButtons_DIRTY_BIT, true);235		}236	}237}

Calls

Called by