Bazaar developer reference

CvProcessProductionAI::LogPossibleBuilds()

Defined in
CvProcessProductionAI.cpp, line 109
Class
CvProcessProductionAI
Hook name
CivHooks::CvProcessProductionAI_LogPossibleBuilds

Hooks

static bool BeforeCvProcessProductionAI_LogPossibleBuilds(CvProcessProductionAI* self);static void AfterCvProcessProductionAI_LogPossibleBuilds(CvProcessProductionAI* self);static void ReplaceCvProcessProductionAI_LogPossibleBuilds(void (*original)(CvProcessProductionAI*), CvProcessProductionAI* self);CivRegisterBefore<CivHooks::CvProcessProductionAI_LogPossibleBuilds>(host, &BeforeCvProcessProductionAI_LogPossibleBuilds);CivRegisterAfter<CivHooks::CvProcessProductionAI_LogPossibleBuilds>(host, &AfterCvProcessProductionAI_LogPossibleBuilds);CivRegisterReplace<CivHooks::CvProcessProductionAI_LogPossibleBuilds>(host, &ReplaceCvProcessProductionAI_LogPossibleBuilds);

Code

108/// Log all potential builds109void CvProcessProductionAI::LogPossibleBuilds()110{111	if(GC.getLogging() && GC.getAILogging())112	{113		CvString strOutBuf;114		CvString strBaseString;115		CvString strTemp;116		CvString playerName;117		CvString cityName;118		CvString strDesc;119		CvString strLogName;120121		CvAssert(m_pCity);122		if(!m_pCity) return;123124		// Find the name of this civ and city125		playerName = GET_PLAYER(m_pCity->getOwner()).getCivilizationShortDescription();126		cityName = m_pCity->getName();127128		// Open the log file129		FILogFile* pLog;130		pLog = LOGFILEMGR.GetLog(m_pCity->GetCityStrategyAI()->GetLogFileName(playerName, cityName), FILogFile::kDontTimeStamp);131		CvAssert(pLog);132		if(!pLog) return;133134		// Get the leading info for this line135		strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns());136		strBaseString += playerName + ", " + cityName + ", ";137138		// Dump out the weight of each buildable item139		for(int iI = 0; iI < m_Buildables.size(); iI++)140		{141			CvProcessInfo* pProcessInfo = GC.getProcessInfo((ProcessTypes)m_Buildables.GetElement(iI));142			strDesc = (pProcessInfo != NULL)? pProcessInfo->GetDescription() : "Unknown";143			strTemp.Format("Process, %s, %d", strDesc.GetCString(), m_Buildables.GetWeight(iI));144			strOutBuf = strBaseString + strTemp;145			pLog->Msg(strOutBuf);146		}147	}148}

Calls