Bazaar developer reference

CvGameSpeedInfo::CacheResults(Database::Results &, CvDatabaseUtility &)

Defined in
CvInfos.cpp, line 3491
Class
CvGameSpeedInfo
Hook name
CivHooks::CvGameSpeedInfo_CacheResults
Overrides
CvBaseInfo::CacheResults(Database::Results &, CvDatabaseUtility &)

Hooks

static bool BeforeCvGameSpeedInfo_CacheResults(CvGameSpeedInfo* self, Database::Results& kResults, CvDatabaseUtility& kUtility, bool& result);static void AfterCvGameSpeedInfo_CacheResults(CvGameSpeedInfo* self, Database::Results& kResults, CvDatabaseUtility& kUtility, bool& result);static bool ReplaceCvGameSpeedInfo_CacheResults(bool (*original)(CvGameSpeedInfo*, Database::Results&, CvDatabaseUtility&), CvGameSpeedInfo* self, Database::Results& kResults, CvDatabaseUtility& kUtility);CivRegisterBefore<CivHooks::CvGameSpeedInfo_CacheResults>(host, &BeforeCvGameSpeedInfo_CacheResults);CivRegisterAfter<CivHooks::CvGameSpeedInfo_CacheResults>(host, &AfterCvGameSpeedInfo_CacheResults);CivRegisterReplace<CivHooks::CvGameSpeedInfo_CacheResults>(host, &ReplaceCvGameSpeedInfo_CacheResults);

Code

3491bool CvGameSpeedInfo::CacheResults(Database::Results& kResults, CvDatabaseUtility& kUtility)3492{3493	if(!CvBaseInfo::CacheResults(kResults, kUtility))3494		return false;34953496	m_iDealDuration					= kResults.GetInt("DealDuration");3497	m_iGrowthPercent				= kResults.GetInt("GrowthPercent");3498	m_iTrainPercent					= kResults.GetInt("TrainPercent");3499	m_iConstructPercent				= kResults.GetInt("ConstructPercent");3500	m_iCreatePercent				= kResults.GetInt("CreatePercent");3501	m_iResearchPercent				= kResults.GetInt("ResearchPercent");3502	m_iGoldPercent					= kResults.GetInt("GoldPercent");3503	m_iGoldGiftMod					= kResults.GetInt("GoldGiftMod");3504	m_iBuildPercent					= kResults.GetInt("BuildPercent");3505	m_iImprovementPercent			= kResults.GetInt("ImprovementPercent");3506	m_iGreatPeoplePercent			= kResults.GetInt("GreatPeoplePercent");3507	m_iCulturePercent				= kResults.GetInt("CulturePercent");3508	m_iFaithPercent					= kResults.GetInt("FaithPercent");3509	m_iBarbPercent					= kResults.GetInt("BarbPercent");3510	m_iFeatureProductionPercent		= kResults.GetInt("FeatureProductionPercent");3511	m_iUnitDiscoverPercent			= kResults.GetInt("UnitDiscoverPercent");3512	m_iUnitHurryPercent				= kResults.GetInt("UnitHurryPercent");3513	m_iUnitTradePercent				= kResults.GetInt("UnitTradePercent");3514	m_iGoldenAgePercent				= kResults.GetInt("GoldenAgePercent");3515	m_iHurryPercent					= kResults.GetInt("HurryPercent");3516	m_iInflationOffset				= kResults.GetInt("InflationOffset");3517	m_iInflationPercent				= kResults.GetInt("InflationPercent");3518	m_iReligiousPressureAdjacentCity= kResults.GetInt("ReligiousPressureAdjacentCity");3519	m_iVictoryDelayPercent			= kResults.GetInt("VictoryDelayPercent");3520	m_iMinorCivElectionFreqMod		= kResults.GetInt("MinorCivElectionFreqMod");3521	m_iOpinionDurationPercent		= kResults.GetInt("OpinionDurationPercent");3522	m_iSpyRatePercent				= kResults.GetInt("SpyRatePercent");3523	m_iPeaceDealDuration			= kResults.GetInt("PeaceDealDuration");3524	m_iRelationshipDuration			= kResults.GetInt("RelationshipDuration");3525#if defined(MOD_TRADE_ROUTE_SCALING)3526	if (MOD_TRADE_ROUTE_SCALING) {3527		m_iTradeRouteSpeedMod		= kResults.GetInt("TradeRouteSpeedMod");3528	}3529#endif3530	m_iLeaguePercent				= kResults.GetInt("LeaguePercent");35313532	//GameTurnInfos3533	{3534		const char* szGameSpeedInfoType = GetType();35353536		//Calculate number of turn increments3537		char szCountSQL[256];3538		sprintf_s(szCountSQL, "select count(*) from GameSpeed_Turns where GameSpeedType = '%s'", szGameSpeedInfoType);3539		Database::SingleResult kCount;3540		if(DB.Execute(kCount, szCountSQL))3541		{3542			m_iNumTurnIncrements = kCount.GetInt(0);3543		}35443545		//Update turn increments3546		allocateGameTurnInfos(getNumTurnIncrements());3547		char szSQL[256];3548		sprintf_s(szSQL, "select * from GameSpeed_Turns where GameSpeedType = '%s'", szGameSpeedInfoType);3549		Database::Results kArrayResults;3550		if(DB.Execute(kArrayResults, szSQL))3551		{3552			int i = 0;3553			while(kArrayResults.Step())3554			{3555				GameTurnInfo& kInfo = getGameTurnInfo(i++);3556				kInfo.iMonthIncrement = kArrayResults.GetInt("MonthIncrement");3557				kInfo.iNumGameTurnsPerIncrement = kArrayResults.GetInt("TurnsPerIncrement");3558			}3559		}3560	}35613562	return true;3563}

Calls