Hooks
static bool BeforeCvGrandStrategyAI_LogGuessOtherPlayerGrandStrategy(CvGrandStrategyAI* self, const FStaticVector< int, 5, true, c_eCiv5GameplayDLL >& vGrandStrategyPriorities, PlayerTypes ePlayer);static void AfterCvGrandStrategyAI_LogGuessOtherPlayerGrandStrategy(CvGrandStrategyAI* self, const FStaticVector< int, 5, true, c_eCiv5GameplayDLL >& vGrandStrategyPriorities, PlayerTypes ePlayer);static void ReplaceCvGrandStrategyAI_LogGuessOtherPlayerGrandStrategy(void (*original)(CvGrandStrategyAI*, const FStaticVector< int, 5, true, c_eCiv5GameplayDLL >&, PlayerTypes), CvGrandStrategyAI* self, const FStaticVector< int, 5, true, c_eCiv5GameplayDLL >& vGrandStrategyPriorities, PlayerTypes ePlayer);CivRegisterBefore<CivHooks::CvGrandStrategyAI_LogGuessOtherPlayerGrandStrategy>(host, &BeforeCvGrandStrategyAI_LogGuessOtherPlayerGrandStrategy);CivRegisterAfter<CivHooks::CvGrandStrategyAI_LogGuessOtherPlayerGrandStrategy>(host, &AfterCvGrandStrategyAI_LogGuessOtherPlayerGrandStrategy);CivRegisterReplace<CivHooks::CvGrandStrategyAI_LogGuessOtherPlayerGrandStrategy>(host, &ReplaceCvGrandStrategyAI_LogGuessOtherPlayerGrandStrategy);
Code
1240/// Log our guess as to other Players' Active Grand Strategy1241void CvGrandStrategyAI::LogGuessOtherPlayerGrandStrategy(const FStaticVector< int, 5, true, c_eCiv5GameplayDLL >& vGrandStrategyPriorities, PlayerTypes ePlayer)1242{1243 if(GC.getLogging() && GC.getAILogging())1244 {1245 CvString strOutBuf;1246 CvString strBaseString;1247 CvString strTemp;1248 CvString playerName;1249 CvString otherPlayerName;1250 CvString strDesc;1251 CvString strLogName;12521253 // Find the name of this civ and city1254 playerName = GetPlayer()->getCivilizationShortDescription();12551256 // Open the log file1257 if(GC.getPlayerAndCityAILogSplit())1258 {1259 strLogName = "GrandStrategyAI_Guess_Log_" + playerName + ".csv";1260 }1261 else1262 {1263 strLogName = "GrandStrategyAI_Guess_Log.csv";1264 }12651266 FILogFile* pLog;1267 pLog = LOGFILEMGR.GetLog(strLogName, FILogFile::kDontTimeStamp);12681269 AIGrandStrategyTypes eGrandStrategy;1270 int iPriority;12711272 // Loop through Grand Strategies1273 for(int iGrandStrategyLoop = 0; iGrandStrategyLoop < GC.getNumAIGrandStrategyInfos(); iGrandStrategyLoop++)1274 {1275 // Get the leading info for this line1276 strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns());1277 strBaseString += playerName + ", ";12781279 eGrandStrategy = (AIGrandStrategyTypes) iGrandStrategyLoop;1280 iPriority = vGrandStrategyPriorities[iGrandStrategyLoop];12811282 CvAIGrandStrategyXMLEntry* pEntry = GC.getAIGrandStrategyInfo(eGrandStrategy);1283 const char* szGrandStrategyType = (pEntry != NULL)? pEntry->GetType() : "Unknown Strategy";12841285 // GrandStrategy Info1286 if(GetActiveGrandStrategy() == eGrandStrategy)1287 {1288 strTemp.Format("*** %s, %d", szGrandStrategyType, iPriority);1289 }1290 else1291 {1292 strTemp.Format("%s, %d", szGrandStrategyType, iPriority);1293 }1294 otherPlayerName = GET_PLAYER(ePlayer).getCivilizationShortDescription();1295 strOutBuf = strBaseString + otherPlayerName + ", " + strTemp;12961297 if(GetGuessOtherPlayerActiveGrandStrategy(ePlayer) == eGrandStrategy)1298 {1299 // Confidence in our guess1300 switch(GetGuessOtherPlayerActiveGrandStrategyConfidence(ePlayer))1301 {1302 case GUESS_CONFIDENCE_POSITIVE:1303 strTemp.Format("Positive");1304 break;1305 case GUESS_CONFIDENCE_LIKELY:1306 strTemp.Format("Likely");1307 break;1308 case GUESS_CONFIDENCE_UNSURE:1309 strTemp.Format("Unsure");1310 break;1311 default:1312 strTemp.Format("XXX");1313 break;1314 }13151316 strOutBuf += ", " + strTemp;1317 }13181319 pLog->Msg(strOutBuf);1320 }13211322 // One more entry for NO GRAND STRATEGY1323 // Get the leading info for this line1324 strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns());1325 strBaseString += playerName + ", ";13261327 iPriority = vGrandStrategyPriorities[GC.getNumAIGrandStrategyInfos()];13281329 // GrandStrategy Info1330 strTemp.Format("NO_GRAND_STRATEGY, %d", iPriority);1331 otherPlayerName = GET_PLAYER(ePlayer).getCivilizationShortDescription();1332 strOutBuf = strBaseString + otherPlayerName + ", " + strTemp;1333 pLog->Msg(strOutBuf);1334 }1335}