Bazaar developer reference

CvCityReligions::LogFollowersChange(CvReligiousFollowChangeReason)

Defined in
CvReligionClasses.cpp, line 4764
Class
CvCityReligions
Hook name
CivHooks::CvCityReligions_LogFollowersChange

Hooks

static bool BeforeCvCityReligions_LogFollowersChange(CvCityReligions* self, CvReligiousFollowChangeReason eReason);static void AfterCvCityReligions_LogFollowersChange(CvCityReligions* self, CvReligiousFollowChangeReason eReason);static void ReplaceCvCityReligions_LogFollowersChange(void (*original)(CvCityReligions*, CvReligiousFollowChangeReason), CvCityReligions* self, CvReligiousFollowChangeReason eReason);CivRegisterBefore<CivHooks::CvCityReligions_LogFollowersChange>(host, &BeforeCvCityReligions_LogFollowersChange);CivRegisterAfter<CivHooks::CvCityReligions_LogFollowersChange>(host, &AfterCvCityReligions_LogFollowersChange);CivRegisterReplace<CivHooks::CvCityReligions_LogFollowersChange>(host, &ReplaceCvCityReligions_LogFollowersChange);

Code

4763/// Log a message with status information4764void CvCityReligions::LogFollowersChange(CvReligiousFollowChangeReason eReason)4765{4766	if(GC.getLogging() && GC.getAILogging())4767	{4768		CvString strOutBuf;4769		CvString strReasonString;4770		CvString temp;4771		FILogFile* pLog;4772		CvCityReligions* pCityRel = m_pCity->GetCityReligions();47734774		pLog = LOGFILEMGR.GetLog(GC.getGame().GetGameReligions()->GetLogFileName(), FILogFile::kDontTimeStamp);47754776		// Get the leading info for this line4777		strOutBuf.Format("%03d, %d, ", GC.getGame().getElapsedGameTurns(), GC.getGame().getGameTurnYear());4778		strOutBuf += m_pCity->getName();4779		strOutBuf += ", ";47804781		// Add a reason string4782		switch(eReason)4783		{4784		case FOLLOWER_CHANGE_ADJACENT_PRESSURE:4785			strReasonString = "Adjacent city pressure";4786			break;4787		case FOLLOWER_CHANGE_HOLY_CITY:4788			strReasonString = "Holy city pressure";4789			break;4790		case FOLLOWER_CHANGE_POP_CHANGE:4791			strReasonString = "Population change";4792			break;4793		case FOLLOWER_CHANGE_RELIGION_FOUNDED:4794			strReasonString = "Religion founded";4795			break;4796		case FOLLOWER_CHANGE_PANTHEON_FOUNDED:4797			strReasonString = "Pantheon founded";4798			break;4799		case FOLLOWER_CHANGE_CONQUEST:4800			strReasonString = "City captured";4801			break;4802		case FOLLOWER_CHANGE_MISSIONARY:4803			strReasonString = "Missionary expended";4804			break;4805		case FOLLOWER_CHANGE_PROPHET:4806			strReasonString = "Prophet spreading";4807			break;4808		case FOLLOWER_CHANGE_REMOVE_HERESY:4809			strReasonString = "Remove heresy";4810			break;4811		case FOLLOWER_CHANGE_SCRIPTED_CONVERSION:4812			strReasonString = "Scripted conversion";4813			break;4814		case FOLLOWER_CHANGE_SPY_PRESSURE:4815			strReasonString = "Spy pressure";4816			break;4817#if defined(MOD_GLOBAL_RELIGIOUS_SETTLERS)4818		case FOLLOWER_CHANGE_ADOPT_FULLY:4819			strReasonString = "Adopt fully";4820			break;4821#endif4822		}4823		strOutBuf += strReasonString + ", ";4824		temp.Format("Pop: %d", m_pCity->getPopulation());4825		strOutBuf += temp;4826		if(pCityRel->IsReligionInCity())4827		{4828			ReligionTypes eMajority = pCityRel->GetReligiousMajority();4829			if(eMajority != NO_RELIGION)4830			{4831				CvReligionEntry* pEntry = GC.getReligionInfo(eMajority);4832				if(pEntry)4833				{4834					strOutBuf += ", Majority: ";4835					strOutBuf += pEntry->GetDescription();4836					temp.Format("(%d)", pCityRel->GetNumFollowers(eMajority));4837					strOutBuf += temp;4838				}4839			}4840			4841			ReligionTypes eSecondary = pCityRel->GetSecondaryReligion();4842			if (eSecondary != NO_RELIGION)4843			{4844				CvReligionEntry* pEntry = GC.getReligionInfo(eSecondary);4845				if(pEntry)4846				{4847					strOutBuf += ", Secondary: ";4848					strOutBuf += pEntry->GetDescription();4849					temp.Format("(%d)", pCityRel->GetNumFollowers(eSecondary));4850					strOutBuf += temp;4851				}4852			}48534854			temp.Format("Atheists: %d", pCityRel->GetNumFollowers(NO_RELIGION));4855			strOutBuf += ", " + temp;4856		}4857		else4858		{4859			strOutBuf += ", No religion in city";4860		}48614862		pLog->Msg(strOutBuf);4863	}4864}

Calls

Called by