Bazaar developer reference

CvDiplomacyAI::LogWarDeclaration(PlayerTypes, int)

Defined in
CvDiplomacyAI.cpp, line 25427
Class
CvDiplomacyAI
Hook name
CivHooks::CvDiplomacyAI_LogWarDeclaration

Hooks

static bool BeforeCvDiplomacyAI_LogWarDeclaration(CvDiplomacyAI* self, PlayerTypes ePlayer, int iTotalWarWeight);static void AfterCvDiplomacyAI_LogWarDeclaration(CvDiplomacyAI* self, PlayerTypes ePlayer, int iTotalWarWeight);static void ReplaceCvDiplomacyAI_LogWarDeclaration(void (*original)(CvDiplomacyAI*, PlayerTypes, int), CvDiplomacyAI* self, PlayerTypes ePlayer, int iTotalWarWeight);CivRegisterBefore<CivHooks::CvDiplomacyAI_LogWarDeclaration>(host, &BeforeCvDiplomacyAI_LogWarDeclaration);CivRegisterAfter<CivHooks::CvDiplomacyAI_LogWarDeclaration>(host, &AfterCvDiplomacyAI_LogWarDeclaration);CivRegisterReplace<CivHooks::CvDiplomacyAI_LogWarDeclaration>(host, &ReplaceCvDiplomacyAI_LogWarDeclaration);

Code

25426/// Log war declaration25427void CvDiplomacyAI::LogWarDeclaration(PlayerTypes ePlayer, int iTotalWarWeight)25428{25429	if(GC.getLogging() && GC.getAILogging())25430	{25431		CvString strOutBuf;25432		CvString strBaseString;25433		CvString playerName;25434		CvString otherPlayerName;25435		CvString strDesc;25436		CvString strLogName;2543725438		// Find the name of this civ and city25439		playerName = GetPlayer()->getCivilizationShortDescription();2544025441		// Open the log file25442		if(GC.getPlayerAndCityAILogSplit())25443		{25444			strLogName = "DiplomacyAI_Log_" + playerName + ".csv";25445		}25446		else25447		{25448			strLogName = "DiplomacyAI_Log.csv";25449		}2545025451		FILogFile* pLog;25452		pLog = LOGFILEMGR.GetLog(strLogName, FILogFile::kDontTimeStamp);2545325454		// Get the leading info for this line25455		strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns());25456		strBaseString += playerName + ", ";2545725458		otherPlayerName = GET_PLAYER(ePlayer).getCivilizationShortDescription();25459		strOutBuf = strBaseString + ", ***** WAR DECLARATION! *****, " + otherPlayerName;2546025461		if(iTotalWarWeight >= 0)25462		{25463			CvString strWarWeight;25464			strWarWeight.Format(", %d, ", iTotalWarWeight);25465			strOutBuf += strWarWeight;25466		}2546725468		pLog->Msg(strOutBuf);2546925470		OutputDebugString("\n");25471		OutputDebugString(strOutBuf);25472		OutputDebugString("\n");2547325474		// Want this in DiploMessage Log25475//		if (!GET_PLAYER(ePlayer).isMinorCiv())25476		{25477			if(GC.getPlayerAndCityAILogSplit())25478			{25479				strLogName = "DiplomacyAI_Messages_Log_" + playerName + ".csv";25480			}25481			else25482			{25483				strLogName = "DiplomacyAI_Messages_Log.csv";25484			}25485			pLog = LOGFILEMGR.GetLog(strLogName, FILogFile::kDontTimeStamp);25486			pLog->Msg(strOutBuf);25487		}2548825489		// Log it to military AI too25490		m_pPlayer->GetMilitaryAI()->LogDeclarationOfWar(ePlayer);25491	}25492}

Calls

Called by