Bazaar developer reference

CvProjectProductionAI::LogPossibleBuilds()

Defined in
CvProjectProductionAI.cpp, line 140
Class
CvProjectProductionAI
Hook name
CivHooks::CvProjectProductionAI_LogPossibleBuilds

Hooks

static bool BeforeCvProjectProductionAI_LogPossibleBuilds(CvProjectProductionAI* self);static void AfterCvProjectProductionAI_LogPossibleBuilds(CvProjectProductionAI* self);static void ReplaceCvProjectProductionAI_LogPossibleBuilds(void (*original)(CvProjectProductionAI*), CvProjectProductionAI* self);CivRegisterBefore<CivHooks::CvProjectProductionAI_LogPossibleBuilds>(host, &BeforeCvProjectProductionAI_LogPossibleBuilds);CivRegisterAfter<CivHooks::CvProjectProductionAI_LogPossibleBuilds>(host, &AfterCvProjectProductionAI_LogPossibleBuilds);CivRegisterReplace<CivHooks::CvProjectProductionAI_LogPossibleBuilds>(host, &ReplaceCvProjectProductionAI_LogPossibleBuilds);

Code

139/// Log all potential builds140void CvProjectProductionAI::LogPossibleBuilds()141{142	if(GC.getLogging() && GC.getAILogging())143	{144		CvString strOutBuf;145		CvString strBaseString;146		CvString strTemp;147		CvString playerName;148		CvString cityName;149		CvString strDesc;150		CvString strLogName;151152		CvAssert(m_pCity);153		if(!m_pCity) return;154155		// Find the name of this civ and city156		playerName = GET_PLAYER(m_pCity->getOwner()).getCivilizationShortDescription();157		cityName = m_pCity->getName();158159		// Open the log file160		FILogFile* pLog;161		pLog = LOGFILEMGR.GetLog(m_pCity->GetCityStrategyAI()->GetLogFileName(playerName, cityName), FILogFile::kDontTimeStamp);162		CvAssert(pLog);163		if(!pLog) return;164165		// Get the leading info for this line166		strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns());167		strBaseString += playerName + ", " + cityName + ", ";168169		// Dump out the weight of each buildable item170		for(int iI = 0; iI < m_Buildables.size(); iI++)171		{172			CvProjectEntry* pProjectEntry = GC.GetGameProjects()->GetEntry(m_Buildables.GetElement(iI));173174			strDesc = (pProjectEntry != NULL)? pProjectEntry->GetDescription() : "Unknown";175			strTemp.Format("Project, %s, %d", strDesc.GetCString(), m_Buildables.GetWeight(iI));176			strOutBuf = strBaseString + strTemp;177			pLog->Msg(strOutBuf);178		}179	}180}

Calls

Called by