Bazaar developer reference

CvAIOperation::LogOperationStart()

Defined in
CvAIOperation.cpp, line 1195
Class
CvAIOperation
Hook name
CivHooks::CvAIOperation_LogOperationStart

Hooks

static bool BeforeCvAIOperation_LogOperationStart(CvAIOperation* self);static void AfterCvAIOperation_LogOperationStart(CvAIOperation* self);static void ReplaceCvAIOperation_LogOperationStart(void (*original)(CvAIOperation*), CvAIOperation* self);CivRegisterBefore<CivHooks::CvAIOperation_LogOperationStart>(host, &BeforeCvAIOperation_LogOperationStart);CivRegisterAfter<CivHooks::CvAIOperation_LogOperationStart>(host, &AfterCvAIOperation_LogOperationStart);CivRegisterReplace<CivHooks::CvAIOperation_LogOperationStart>(host, &ReplaceCvAIOperation_LogOperationStart);

Code

1194/// Log that an operation has started1195void CvAIOperation::LogOperationStart()1196{1197	if(GC.getLogging() && GC.getAILogging())1198	{1199		CvString strOutBuf;1200		CvString strBaseString;1201		CvString strTemp1;1202		CvString strTemp2;12031204		CvString strPlayerName = GET_PLAYER(m_eOwner).getCivilizationShortDescription();1205		FILogFile* pLog = LOGFILEMGR.GetLog(GetLogFileName(strPlayerName), FILogFile::kDontTimeStamp);12061207		// Get the leading info for this line1208		strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns());1209		strBaseString += strPlayerName + ", " + GetOperationName() + ", ";12101211		for(unsigned int uiI = 0; uiI < m_viArmyIDs.size(); uiI++)1212		{1213			CvArmyAI* pThisArmy = GET_PLAYER(m_eOwner).getArmyAI(m_viArmyIDs[uiI]);1214			strTemp1.Format("Started, Army: %d, Units Recruited: %d, Max Formation Size: %d, ", pThisArmy->GetID(), pThisArmy->GetNumSlotsFilled(), pThisArmy->GetNumFormationEntries());1215		}12161217		strOutBuf = strBaseString + strTemp1;1218		switch(m_eCurrentState)1219		{1220		case AI_OPERATION_STATE_ABORTED:1221			strTemp2 = "Aborted";1222			break;1223		case AI_OPERATION_STATE_RECRUITING_UNITS:1224			strTemp2 = "Recruiting Units";1225			break;1226		case AI_OPERATION_STATE_GATHERING_FORCES:1227			strTemp2 = "Gathering Forces";1228			break;1229		case AI_OPERATION_STATE_MOVING_TO_TARGET:1230			strTemp2 = "Moving To Target";1231			break;1232		case AI_OPERATION_STATE_AT_TARGET:1233			strTemp2 = "At Target";1234			break;1235		case AI_OPERATION_STATE_SUCCESSFUL_FINISH:1236			strTemp2 = "Completed";1237			break;1238		};12391240		strOutBuf += strTemp2;12411242		pLog->Msg(strOutBuf);12431244		// Message to summary log?1245		switch (GetOperationType())1246		{1247		case AI_OPERATION_BASIC_CITY_ATTACK:1248		case AI_OPERATION_PILLAGE_ENEMY:1249		case AI_OPERATION_SNEAK_CITY_ATTACK:1250		case AI_OPERATION_SMALL_CITY_ATTACK:1251		case AI_OPERATION_NAVAL_BOMBARDMENT:1252		case AI_OPERATION_NAVAL_SUPERIORITY:1253		case AI_OPERATION_COLONIZE:1254		case AI_OPERATION_NAVAL_ATTACK:1255		case AI_OPERATION_NAVAL_SNEAK_ATTACK:1256		case AI_OPERATION_CITY_STATE_ATTACK:1257		case AI_OPERATION_CITY_STATE_NAVAL_ATTACK:1258		case AI_OPERATION_NUKE_ATTACK:1259		case AI_OPERATION_PURE_NAVAL_CITY_ATTACK:1260			1261			strOutBuf = GetOperationName() + ", ";1262			strOutBuf += strTemp1 + strTemp2;1263			if (m_eEnemy != NO_PLAYER)1264			{1265				strPlayerName = GET_PLAYER(m_eEnemy).getCivilizationShortDescription();1266				strOutBuf += ", vs. " + strPlayerName;1267			}1268			GET_PLAYER(m_eOwner).GetMilitaryAI()->LogMilitarySummaryMessage(strOutBuf);1269		}1270	}1271}

Calls

Called by