Bazaar developer reference

CvDiplomacyAI::LogStatements()

Defined in
CvDiplomacyAI.cpp, line 26636
Class
CvDiplomacyAI
Hook name
CivHooks::CvDiplomacyAI_LogStatements

Hooks

static bool BeforeCvDiplomacyAI_LogStatements(CvDiplomacyAI* self);static void AfterCvDiplomacyAI_LogStatements(CvDiplomacyAI* self);static void ReplaceCvDiplomacyAI_LogStatements(void (*original)(CvDiplomacyAI*), CvDiplomacyAI* self);CivRegisterBefore<CivHooks::CvDiplomacyAI_LogStatements>(host, &BeforeCvDiplomacyAI_LogStatements);CivRegisterAfter<CivHooks::CvDiplomacyAI_LogStatements>(host, &AfterCvDiplomacyAI_LogStatements);CivRegisterReplace<CivHooks::CvDiplomacyAI_LogStatements>(host, &ReplaceCvDiplomacyAI_LogStatements);

Code

26635/// Log Statements, to make sure our record is solid26636void CvDiplomacyAI::LogStatements()26637{26638	if(GC.getLogging() && GC.getAILogging())26639	{26640		CvString strOutBuf;26641		CvString strBaseString;26642		CvString playerName;26643		CvString otherPlayerName;26644		CvString strMinorString;26645		CvString strDesc;26646		CvString strLogName;26647		CvString strTemp;2664826649		// Find the name of this civ and city26650		playerName = GetPlayer()->getCivilizationShortDescription();2665126652		// Open the log file26653		if(GC.getPlayerAndCityAILogSplit())26654		{26655			strLogName = "DiplomacyAI_Statement_Log_" + playerName + ".csv";26656		}26657		else26658		{26659			strLogName = "DiplomacyAI_Statement_Log.csv";26660		}2666126662		FILogFile* pLog;26663		pLog = LOGFILEMGR.GetLog(strLogName, FILogFile::kDontTimeStamp);2666426665		// Get the leading info for this line26666		strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns());26667		strBaseString += playerName;2666826669		int iPlayerLoop;26670		PlayerTypes eLoopPlayer;2667126672		CvString strStatementLine;2667326674		int iItem;26675		DiploStatementTypes eStatement;26676		int iTurn;2667726678		// Loop through all (known) Players26679		for(iPlayerLoop = 0; iPlayerLoop < MAX_MAJOR_CIVS; iPlayerLoop++)26680		{26681			eLoopPlayer = (PlayerTypes) iPlayerLoop;2668226683			if(IsPlayerValid(eLoopPlayer))26684			{26685				otherPlayerName = GET_PLAYER(eLoopPlayer).getCivilizationShortDescription();2668626687				// Diplo Statement Log Counter26688				for(iItem = 0; iItem < MAX_DIPLO_LOG_STATEMENTS; iItem++)26689				{26690					eStatement = GetDiploLogStatementTypeForIndex(eLoopPlayer, iItem);2669126692					if(eStatement != NO_DIPLO_STATEMENT_TYPE)26693					{26694						iTurn = GetDiploLogStatementTurnForIndex(eLoopPlayer, iItem);2669526696						strStatementLine.Format(", Statement: %d, Index: %d, Turn %d", eStatement, iItem, iTurn);2669726698						strOutBuf = strBaseString;2669926700						strOutBuf += ", " + otherPlayerName;26701						strOutBuf += strStatementLine;2670226703						pLog->Msg(strOutBuf);26704					}26705				}26706			}26707		}26708	}26709}

Calls

Called by