Bazaar developer reference

CvAIOperation::LogOperationEnd()

Defined in
CvAIOperation.cpp, line 1416
Class
CvAIOperation
Hook name
CivHooks::CvAIOperation_LogOperationEnd

Hooks

static bool BeforeCvAIOperation_LogOperationEnd(CvAIOperation* self);static void AfterCvAIOperation_LogOperationEnd(CvAIOperation* self);static void ReplaceCvAIOperation_LogOperationEnd(void (*original)(CvAIOperation*), CvAIOperation* self);CivRegisterBefore<CivHooks::CvAIOperation_LogOperationEnd>(host, &BeforeCvAIOperation_LogOperationEnd);CivRegisterAfter<CivHooks::CvAIOperation_LogOperationEnd>(host, &AfterCvAIOperation_LogOperationEnd);CivRegisterReplace<CivHooks::CvAIOperation_LogOperationEnd>(host, &ReplaceCvAIOperation_LogOperationEnd);

Code

1415/// Log that an operation has ended1416void CvAIOperation::LogOperationEnd()1417{1418	if(GC.getLogging() && GC.getAILogging())1419	{1420		CvString strOutBuf;1421		CvString strBaseString;1422		CvString strTemp;14231424		CvString strPlayerName = GET_PLAYER(m_eOwner).getCivilizationShortDescription();1425		FILogFile* pLog = LOGFILEMGR.GetLog(GetLogFileName(strPlayerName), FILogFile::kDontTimeStamp);14261427		// Get the leading info for this line1428		strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns());1429		strBaseString += strPlayerName + ", " + GetOperationName() + ", ";14301431		strTemp = "Ended, ";14321433		switch(m_eAbortReason)1434		{1435		case AI_ABORT_SUCCESS:1436			strTemp += "Success";1437			break;1438		case AI_ABORT_NO_TARGET:1439			strTemp += "No target";1440			break;1441		case AI_ABORT_REPEAT_TARGET:1442			strTemp += "Repeat target";1443			break;1444		case AI_ABORT_LOST_TARGET:1445			strTemp += "Lost target";1446			break;1447		case AI_ABORT_TARGET_ALREADY_CAPTURED:1448			strTemp += "Target already captured";1449			break;1450		case AI_ABORT_NO_ROOM_DEPLOY:1451			strTemp += "No room to deploy";1452			break;1453		case AI_ABORT_HALF_STRENGTH:1454			strTemp += "Half strength";1455			break;1456		case AI_ABORT_NO_MUSTER:1457			strTemp += "No muster point";1458			break;1459		case AI_ABORT_LOST_CIVILIAN:1460			strTemp += "Lost civilian";1461			break;1462		case AI_ABORT_ESCORT_DIED:1463			strTemp += "Escort died";1464			break;1465		case AI_ABORT_NO_NUKES:1466			strTemp += "No nukes";1467			break;1468		case AI_ABORT_KILLED:1469			strTemp += "Killed";1470			break;1471		case AI_ABORT_WAR_STATE_CHANGE:1472			strTemp += "War State Change";1473			break;1474		case AI_ABORT_DIPLO_OPINION_CHANGE:1475			strTemp += "Diplo Opinion Change";1476			break;1477		case AI_ABORT_LOST_PATH:1478			strTemp += "Lost Path to Target";1479			break;1480		}14811482		strOutBuf = strBaseString + strTemp;1483		pLog->Msg(strOutBuf);14841485		// Message to summary log?1486		switch (GetOperationType())1487		{1488		case AI_OPERATION_BASIC_CITY_ATTACK:1489		case AI_OPERATION_PILLAGE_ENEMY:1490		case AI_OPERATION_SNEAK_CITY_ATTACK:1491		case AI_OPERATION_SMALL_CITY_ATTACK:1492		case AI_OPERATION_NAVAL_BOMBARDMENT:1493		case AI_OPERATION_NAVAL_SUPERIORITY:1494		case AI_OPERATION_COLONIZE:1495		case AI_OPERATION_NAVAL_ATTACK:1496		case AI_OPERATION_NAVAL_SNEAK_ATTACK:1497		case AI_OPERATION_CITY_STATE_ATTACK:1498		case AI_OPERATION_CITY_STATE_NAVAL_ATTACK:1499		case AI_OPERATION_NUKE_ATTACK:1500		case AI_OPERATION_PURE_NAVAL_CITY_ATTACK:1501			strOutBuf = GetOperationName() + ", ";1502			strOutBuf += strTemp;1503			GET_PLAYER(m_eOwner).GetMilitaryAI()->LogMilitarySummaryMessage(strOutBuf);1504		}1505	}1506}

Calls

Called by