/// Log chosen policy void CvPolicyAI::LogPolicyChoice(PolicyTypes ePolicy) { if(GC.getLogging() && GC.getAILogging()) { CvString strOutBuf; CvString strBaseString; CvString strTemp; CvString playerName; CvString strDesc; // Find the name of this civ and city playerName = m_pCurrentPolicies->GetPlayer()->getCivilizationShortDescription(); FILogFile* pLog; pLog = LOGFILEMGR.GetLog(GetLogFileName(playerName), FILogFile::kDontTimeStamp); // Get the leading info for this line strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns()); strBaseString += playerName + ", "; CvPolicyEntry* pPolicyEntry = GC.getPolicyInfo(ePolicy); const char* szPolicyType = (pPolicyEntry != NULL)? pPolicyEntry->GetType() : "Unknown"; strTemp.Format("CHOSEN, %s", szPolicyType); strOutBuf = strBaseString + strTemp; pLog->Msg(strOutBuf); } }
/// Log all possible policy choices void CvPolicyAI::LogPossiblePolicies() { if(GC.getLogging() && GC.getAILogging()) { CvString strOutBuf; CvString strBaseString; CvString strTemp; CvString playerName; CvString strDesc; // Find the name of this civ and city playerName = m_pCurrentPolicies->GetPlayer()->getCivilizationShortDescription(); FILogFile* pLog; pLog = LOGFILEMGR.GetLog(GetLogFileName(playerName), FILogFile::kDontTimeStamp); // Get the leading info for this line strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns()); strBaseString += playerName + ", "; int iNumBranches = GC.getNumPolicyBranchInfos(); // Dump out the weight of each possible policy for(int iI = 0; iI < m_AdoptablePolicies.size(); iI++) { int iWeight = m_AdoptablePolicies.GetWeight(iI); if(m_AdoptablePolicies.GetElement(iI) < iNumBranches) { strTemp.Format("Branch %d, %d", m_AdoptablePolicies.GetElement(iI), iWeight); } else { PolicyTypes ePolicy = (PolicyTypes)(m_AdoptablePolicies.GetElement(iI) - iNumBranches); CvPolicyEntry* pPolicyEntry = GC.getPolicyInfo(ePolicy); const char* szPolicyType = (pPolicyEntry != NULL)? pPolicyEntry->GetType() : "Unknown"; strTemp.Format("%s, %d", szPolicyType, iWeight); } strOutBuf = strBaseString + strTemp; pLog->Msg(strOutBuf); } } }