Clarification needed for CityConvertsReligion

Despite its name GameEvents.CityConvertsReligion fires when the follower count changes.

Code:
if(eMajority != eOldMajorityReligion || iFollowers != iOldFollowers)
	{
		CityConvertsReligion(eMajority, eOldMajorityReligion, eResponsibleParty);
		GC.GetEngineUserInterface()->setDirty(CityInfo_DIRTY_BIT, true);
		LogFollowersChange(eReason);
	}

The C++ function CityConvertsReligion eventually fires the lua event. It would be much convenient and intuitive if it only fired when the majority religion changed, but I do have some lua code that listens to the GameEvents.CityConvertsReligion does some filtering logic and fires off a lua event only when a city's majority religion changes.
 
Despite its name GameEvents.CityConvertsReligion fires when the follower count changes.

Code:
if(eMajority != eOldMajorityReligion || iFollowers != iOldFollowers)
	{
		CityConvertsReligion(eMajority, eOldMajorityReligion, eResponsibleParty);
		GC.GetEngineUserInterface()->setDirty(CityInfo_DIRTY_BIT, true);
		LogFollowersChange(eReason);
	}

The C++ function CityConvertsReligion eventually fires the lua event. It would be much convenient and intuitive if it only fired when the majority religion changed, but I do have some lua code that listens to the GameEvents.CityConvertsReligion does some filtering logic and fires off a lua event only when a city's majority religion changes.

Very true, I read the wrong function, machiavelli's got the right one. And the lua args don't even tell you what the totals are/were. :(
 
My function was to fire off when a religion achieves a religious majority in a city... then it installs a building. I'll simply, during the cityconvertsreligion event, have a check for the building and appropriate religion as majority and install the building if it doesn't yet exist. No need to do anything else as the presence of the building will serve to regulate the operation of the function and make certain it does not constantly run every time a citizen converts.

Thank-you both for the input.
 
Back
Top Bottom