Bazaar developer reference

CvPolicyAI::LogPolicyChoice(PolicyTypes)

Defined in
CvPolicyAI.cpp, line 936
Class
CvPolicyAI
Hook name
CivHooks::CvPolicyAI_LogPolicyChoice

Hooks

static bool BeforeCvPolicyAI_LogPolicyChoice(CvPolicyAI* self, PolicyTypes ePolicy);static void AfterCvPolicyAI_LogPolicyChoice(CvPolicyAI* self, PolicyTypes ePolicy);static void ReplaceCvPolicyAI_LogPolicyChoice(void (*original)(CvPolicyAI*, PolicyTypes), CvPolicyAI* self, PolicyTypes ePolicy);CivRegisterBefore<CivHooks::CvPolicyAI_LogPolicyChoice>(host, &BeforeCvPolicyAI_LogPolicyChoice);CivRegisterAfter<CivHooks::CvPolicyAI_LogPolicyChoice>(host, &AfterCvPolicyAI_LogPolicyChoice);CivRegisterReplace<CivHooks::CvPolicyAI_LogPolicyChoice>(host, &ReplaceCvPolicyAI_LogPolicyChoice);

Code

935/// Log chosen policy936void CvPolicyAI::LogPolicyChoice(PolicyTypes ePolicy)937{938	if(GC.getLogging() && GC.getAILogging())939	{940		CvString strOutBuf;941		CvString strBaseString;942		CvString strTemp;943		CvString playerName;944		CvString strDesc;945946		// Find the name of this civ and city947		playerName = m_pCurrentPolicies->GetPlayer()->getCivilizationShortDescription();948949		FILogFile* pLog;950		pLog = LOGFILEMGR.GetLog(GetLogFileName(playerName), FILogFile::kDontTimeStamp);951952		// Get the leading info for this line953		strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns());954		strBaseString += playerName + ", ";955956		CvPolicyEntry* pPolicyEntry = GC.getPolicyInfo(ePolicy);957		const char* szPolicyType = (pPolicyEntry != NULL)? pPolicyEntry->GetType() : "Unknown";958		strTemp.Format("CHOSEN, %s", szPolicyType);959960		strOutBuf = strBaseString + strTemp;961		pLog->Msg(strOutBuf);962	}963}

Calls

Called by