Bazaar developer reference

CvDiplomacyAI::LogStatus()

Defined in
CvDiplomacyAI.cpp, line 26318
Class
CvDiplomacyAI
Hook name
CivHooks::CvDiplomacyAI_LogStatus

Hooks

static bool BeforeCvDiplomacyAI_LogStatus(CvDiplomacyAI* self);static void AfterCvDiplomacyAI_LogStatus(CvDiplomacyAI* self);static void ReplaceCvDiplomacyAI_LogStatus(void (*original)(CvDiplomacyAI*), CvDiplomacyAI* self);CivRegisterBefore<CivHooks::CvDiplomacyAI_LogStatus>(host, &BeforeCvDiplomacyAI_LogStatus);CivRegisterAfter<CivHooks::CvDiplomacyAI_LogStatus>(host, &AfterCvDiplomacyAI_LogStatus);CivRegisterReplace<CivHooks::CvDiplomacyAI_LogStatus>(host, &ReplaceCvDiplomacyAI_LogStatus);

Code

26317/// Log diplomatic status with other Players26318void CvDiplomacyAI::LogStatus()26319{26320	if(GC.getLogging() && GC.getAILogging())26321	{26322		CvString strOutBuf;26323		CvString strBaseString;26324		CvString playerName;26325		CvString otherPlayerName;26326		CvString strMinorString;26327		CvString strDesc;26328		CvString strLogName;26329		CvString strTemp;2633026331		// Find the name of this civ and city26332		playerName = GetPlayer()->getCivilizationShortDescription();2633326334		// Open the log file26335		if(GC.getPlayerAndCityAILogSplit())26336		{26337			strLogName = "DiplomacyAI_Log_" + playerName + ".csv";26338		}26339		else26340		{26341			strLogName = "DiplomacyAI_Log.csv";26342		}2634326344		FILogFile* pLog;26345		pLog = LOGFILEMGR.GetLog(strLogName, FILogFile::kDontTimeStamp);2634626347		// Get the leading info for this line26348		strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns());26349		strBaseString += playerName;2635026351		int iPlayerLoop;26352		PlayerTypes eLoopPlayer;2635326354		// Loop through all (known) Players26355		for(iPlayerLoop = 0; iPlayerLoop < MAX_CIV_PLAYERS; iPlayerLoop++)26356		{26357			eLoopPlayer = (PlayerTypes) iPlayerLoop;2635826359			if(IsPlayerValid(eLoopPlayer))26360			{26361				strOutBuf = strBaseString;2636226363				LogGrandStrategy(strOutBuf);2636426365				// Name26366				if(GET_PLAYER(eLoopPlayer).isMinorCiv())26367				{26368					strMinorString = "--- ";26369				}2637026371				otherPlayerName = GET_PLAYER(eLoopPlayer).getCivilizationShortDescription();26372				strOutBuf += ", " + strMinorString + otherPlayerName;2637326374				// Major Civ26375				if(!GET_PLAYER(eLoopPlayer).isMinorCiv())26376				{26377					if(IsDoFAccepted(eLoopPlayer))26378						strOutBuf += ", WW";26379					else26380						strOutBuf += ", ";2638126382					if(IsDenouncedPlayer(eLoopPlayer))26383						strOutBuf += ", DEN";26384					else26385						strOutBuf += ", ";2638626387					//if (IsWorkingAgainstPlayer(eLoopPlayer))26388					//	strOutBuf += ", WA";26389					//else26390					//	strOutBuf += ", ";2639126392					if(GetGlobalCoopWarAcceptedState(eLoopPlayer) == COOP_WAR_STATE_ACCEPTED)26393						strOutBuf += ", CW";26394					else if(GetGlobalCoopWarAcceptedState(eLoopPlayer) == COOP_WAR_STATE_SOON)26395						strOutBuf += ", CWS";26396					else26397						strOutBuf += ", ";2639826399					LogMajorCivApproach(strOutBuf, GetMajorCivApproach(eLoopPlayer, /*bHideTrueFeelings*/ false), GetWarFaceWithPlayer(eLoopPlayer));26400					LogOpinion(strOutBuf, eLoopPlayer);26401				}26402				// Minor Civ26403				else26404				{26405					strOutBuf += ", ";		// Working With26406					strOutBuf += ", ";		// Working Against26407					strOutBuf += ", ";		// Coop War2640826409					LogMinorCivApproach(strOutBuf, GetMinorCivApproach(eLoopPlayer));26410					strOutBuf += ", ";		// Opinion26411				}2641226413				LogProximity(strOutBuf, eLoopPlayer);2641426415				LogWarState(strOutBuf, eLoopPlayer);2641626417				LogEconomicStrength(strOutBuf, eLoopPlayer);2641826419				LogMilitaryStrength(strOutBuf, eLoopPlayer);26420				LogTargetValue(strOutBuf, eLoopPlayer);26421				LogMilitaryAggressivePosture(strOutBuf, eLoopPlayer);26422				LogWarmongerThreat(strOutBuf, eLoopPlayer);26423				LogMilitaryThreat(strOutBuf, eLoopPlayer);2642426425				LogExpansionAggressivePosture(strOutBuf, eLoopPlayer);26426				LogPlotBuyingAggressivePosture(strOutBuf, eLoopPlayer);26427				LogLandDispute(strOutBuf, eLoopPlayer);26428				LogVictoryDispute(strOutBuf, eLoopPlayer);26429				LogWonderDispute(strOutBuf, eLoopPlayer);26430				LogMinorCivDispute(strOutBuf, eLoopPlayer);2643126432				// Other Player's Estimated Grand Strategy26433				if(!GET_PLAYER(eLoopPlayer).isMinorCiv())26434				{26435					AIGrandStrategyTypes eGrandStrategy = GetPlayer()->GetGrandStrategyAI()->GetGuessOtherPlayerActiveGrandStrategy(eLoopPlayer);2643626437					CvAIGrandStrategyXMLEntry* pEntry = (eGrandStrategy != NO_AIGRANDSTRATEGY)? GC.getAIGrandStrategyInfo(eGrandStrategy) : NULL;26438					if(pEntry != NULL)26439					{26440						strTemp.Format("GSS %s", pEntry->GetType());26441						strOutBuf += ", " + strTemp;2644226443						// Confidence in our guess26444						switch(GetPlayer()->GetGrandStrategyAI()->GetGuessOtherPlayerActiveGrandStrategyConfidence(eLoopPlayer))26445						{26446						case GUESS_CONFIDENCE_POSITIVE:26447							strTemp.Format("POSITIVE");26448							break;26449						case GUESS_CONFIDENCE_LIKELY:26450							strTemp.Format("Likely");26451							break;26452						case GUESS_CONFIDENCE_UNSURE:26453							strTemp.Format("Unsure");26454							break;26455						default:26456							strTemp.Format("XXX");26457							break;26458						}26459					}26460					else26461					{26462						strTemp.Format("No GS Guess, ");26463					}26464				}26465				else26466				{26467					strTemp.Format(", ");26468				}26469				strOutBuf += ", " + strTemp;2647026471				pLog->Msg(strOutBuf);26472			}26473		}26474	}26475}

Calls

Called by