Bazaar developer reference

CvGrandStrategyAI::LogGrandStrategies(const FStaticVector<int, 5, true, c_eCiv5GameplayDLL> &)

Defined in
CvGrandStrategyAI.cpp, line 1184
Class
CvGrandStrategyAI
Hook name
CivHooks::CvGrandStrategyAI_LogGrandStrategies

Hooks

static bool BeforeCvGrandStrategyAI_LogGrandStrategies(CvGrandStrategyAI* self, const FStaticVector< int, 5, true, c_eCiv5GameplayDLL >& vModifiedGrandStrategyPriorities);static void AfterCvGrandStrategyAI_LogGrandStrategies(CvGrandStrategyAI* self, const FStaticVector< int, 5, true, c_eCiv5GameplayDLL >& vModifiedGrandStrategyPriorities);static void ReplaceCvGrandStrategyAI_LogGrandStrategies(void (*original)(CvGrandStrategyAI*, const FStaticVector< int, 5, true, c_eCiv5GameplayDLL >&), CvGrandStrategyAI* self, const FStaticVector< int, 5, true, c_eCiv5GameplayDLL >& vModifiedGrandStrategyPriorities);CivRegisterBefore<CivHooks::CvGrandStrategyAI_LogGrandStrategies>(host, &BeforeCvGrandStrategyAI_LogGrandStrategies);CivRegisterAfter<CivHooks::CvGrandStrategyAI_LogGrandStrategies>(host, &AfterCvGrandStrategyAI_LogGrandStrategies);CivRegisterReplace<CivHooks::CvGrandStrategyAI_LogGrandStrategies>(host, &ReplaceCvGrandStrategyAI_LogGrandStrategies);

Code

1183/// Log GrandStrategy state: what are the Priorities and who is Active?1184void CvGrandStrategyAI::LogGrandStrategies(const FStaticVector< int, 5, true, c_eCiv5GameplayDLL >& vModifiedGrandStrategyPriorities)1185{1186	if(GC.getLogging() && GC.getAILogging())1187	{1188		CvString strOutBuf;1189		CvString strBaseString;1190		CvString strTemp;1191		CvString playerName;1192		CvString strDesc;1193		CvString strLogName;11941195		// Find the name of this civ and city1196		playerName = GetPlayer()->getCivilizationShortDescription();11971198		// Open the log file1199		if(GC.getPlayerAndCityAILogSplit())1200		{1201			strLogName = "GrandStrategyAI_Log_" + playerName + ".csv";1202		}1203		else1204		{1205			strLogName = "GrandStrategyAI_Log.csv";1206		}12071208		FILogFile* pLog;1209		pLog = LOGFILEMGR.GetLog(strLogName, FILogFile::kDontTimeStamp);12101211		AIGrandStrategyTypes eGrandStrategy;12121213		// Loop through Grand Strategies1214		for(int iGrandStrategyLoop = 0; iGrandStrategyLoop < GC.getNumAIGrandStrategyInfos(); iGrandStrategyLoop++)1215		{1216			// Get the leading info for this line1217			strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns());1218			strBaseString += playerName + ", ";12191220			eGrandStrategy = (AIGrandStrategyTypes) iGrandStrategyLoop;12211222			// GrandStrategy Info1223			CvAIGrandStrategyXMLEntry* pEntry = GC.getAIGrandStrategyInfo(eGrandStrategy);1224			const char* szAIGrandStrategyType = (pEntry != NULL)? pEntry->GetType() : "Unknown Type";12251226			if(GetActiveGrandStrategy() == eGrandStrategy)1227			{1228				strTemp.Format("*** %s, %d, %d", szAIGrandStrategyType, GetGrandStrategyPriority(eGrandStrategy), vModifiedGrandStrategyPriorities[eGrandStrategy]);1229			}1230			else1231			{1232				strTemp.Format("%s, %d, %d", szAIGrandStrategyType, GetGrandStrategyPriority(eGrandStrategy), vModifiedGrandStrategyPriorities[eGrandStrategy]);1233			}1234			strOutBuf = strBaseString + strTemp;1235			pLog->Msg(strOutBuf);1236		}1237	}1238}

Calls

Called by