//------------------------------------------------------------------------------ bool CvDllDatabaseUtility::PrefetchGameData() { cvStopWatch kTest("PrefetchGameData", "xml-perf.log"); //Because Colors and PlayerColors are used everywhere during load //(by the translator) we load interface infos first. //Interface PrefetchCollection(GC.GetColorInfo(), "Colors"); PrefetchCollection(GC.GetPlayerColorInfo(), "PlayerColors"); PrefetchCollection(GC.getInterfaceModeInfo(), "InterfaceModes"); //AI PrefetchCollection(GC.getAICityStrategyInfo(), "AICityStrategies"); PrefetchCollection(GC.getEconomicAIStrategyInfo(), "AIEconomicStrategies"); PrefetchCollection(GC.getAIGrandStrategyInfo(), "AIGrandStrategies"); PrefetchCollection(GC.getMilitaryAIStrategyInfo(), "AIMilitaryStrategies"); PrefetchCollection(GC.getCitySpecializationInfo(), "CitySpecializations"); PrefetchCollection(GC.getTacticalMoveInfo(), "TacticalMoves"); //BasicInfos //AnimationOperators? //Attitudes? PrefetchCollection(GC.getUnitAIInfo(), "UnitAIInfos"); PrefetchCollection(GC.getUnitCombatClassInfo(), "UnitCombatInfos"); //Buildings PrefetchCollection(GC.getBuildingClassInfo(), "BuildingClasses"); PrefetchCollection(GC.getBuildingInfo(), "Buildings"); //GameInfo PrefetchCollection(GC.getEmphasisInfo(), "EmphasizeInfos"); PrefetchCollection(GC.getEraInfo(), "Eras"); PrefetchCollection(GC.getGameOptionInfo(), "GameOptions"); PrefetchCollection(GC.getGameSpeedInfo(), "GameSpeeds"); PrefetchCollection(GC.getHandicapInfo(), "HandicapInfos"); PrefetchCollection(GC.getHurryInfo(), "HurryInfos"); PrefetchCollection(GC.getMPOptionInfo(), "MultiplayerOptions"); PrefetchCollection(GC.getPlayerOptionInfo(), "PlayerOptions"); PrefetchCollection(GC.getPolicyInfo(), "Policies"); PrefetchCollection(GC.getPolicyBranchInfo(), "PolicyBranchTypes"); PrefetchCollection(GC.getProcessInfo(), "Processes"); PrefetchCollection(GC.getProjectInfo(), "Projects"); PrefetchCollection(GC.getSmallAwardInfo(), "SmallAwards"); PrefetchCollection(GC.getSpecialistInfo(), "Specialists"); PrefetchCollection(GC.getVictoryInfo(), "Victories"); PrefetchCollection(GC.getVoteInfo(), "Votes"); PrefetchCollection(GC.getVoteSourceInfo(), "VoteSources"); PrefetchCollection(GC.getUnitDomainInfo(), "Domains"); //Leaders PrefetchCollection(GC.getLeaderHeadInfo(), "Leaders"); //Misc PrefetchCollection(GC.getRouteInfo(), "Routes"); CvNotificationXMLEntries* pkNotificationEntries = GC.GetNotificationEntries(); if(pkNotificationEntries != NULL) { PrefetchCollection(pkNotificationEntries->GetNotificationEntries(), "Notifications"); } //Technologies PrefetchCollection(GC.getTechInfo(), "Technologies"); //Terrain PrefetchCollection(GC.getFeatureInfo(), "Features"); PrefetchCollection(GC.getImprovementInfo(), "Improvements"); PrefetchCollection(GC.getResourceClassInfo(), "ResourceClasses"); PrefetchCollection(GC.getResourceInfo(), "Resources"); PrefetchCollection(GC.getTerrainInfo(), "Terrains"); PrefetchCollection(GC.getYieldInfo(), "Yields"); //Units PrefetchCollection(GC.getAutomateInfo(), "Automates"); PrefetchCollection(GC.getBuildInfo(), "Builds"); PrefetchCollection(GC.getCommandInfo(), "Commands"); PrefetchCollection(GC.getControlInfo(), "Controls"); PrefetchCollection(GC.getEntityEventInfo(), "EntityEvents"); PrefetchCollection(GC.getMissionInfo(), "Missions"); PrefetchCollection(GC.getMultiUnitFormationInfo(), "MultiUnitFormations"); PrefetchCollection(GC.getSpecialUnitInfo(), "SpecialUnits"); PrefetchCollection(GC.getUnitClassInfo(), "UnitClasses"); PrefetchCollection(GC.getPromotionInfo(), "UnitPromotions"); PrefetchCollection(GC.getUnitInfo(), "Units"); //Civilizations - must be after buildings and units PrefetchCollection(GC.getCivilizationInfo(), "Civilizations"); PrefetchCollection(GC.getMinorCivInfo(), "MinorCivilizations"); PrefetchCollection(GC.getTraitInfo(), "Traits"); PrefetchCollection(GC.getReligionInfo(), "Religions"); PrefetchCollection(GC.getBeliefInfo(), "Beliefs"); //Copy flavors into string array { CvDatabaseUtility kUtility; CvString*& paFlavors = GC.getFlavorTypes(); const int iNumFlavors = kUtility.MaxRows("Flavors"); //GC.getNumFlavorTypes() = iNumFlavors; GC.setNumFlavorTypes(iNumFlavors); paFlavors = FNEW(CvString[iNumFlavors], c_eCiv5GameplayDLL, 0); Database::Results kResults("Type"); if(DB.SelectAll(kResults, "Flavors")) { int i = 0; while(kResults.Step()) { paFlavors[i++] = kResults.GetText(0); } } else { CvAssertMsg(false, DB.ErrorMessage()); } } ValidatePrefetchProcess(); return true; }
//------------------------------------------------------------------------------ bool CvDllDatabaseUtility::PrefetchGameData() { cvStopWatch kTest("PrefetchGameData", "xml-perf.log"); //Because Colors and PlayerColors are used everywhere during load //(by the translator) we load interface infos first. //Interface PrefetchCollection(GC.GetColorInfo(), "Colors"); PrefetchCollection(GC.GetPlayerColorInfo(), "PlayerColors"); PrefetchCollection(GC.getInterfaceModeInfo(), "InterfaceModes"); //AI PrefetchCollection(GC.getAICityStrategyInfo(), "AICityStrategies"); PrefetchCollection(GC.getEconomicAIStrategyInfo(), "AIEconomicStrategies"); PrefetchCollection(GC.getAIGrandStrategyInfo(), "AIGrandStrategies"); PrefetchCollection(GC.getMilitaryAIStrategyInfo(), "AIMilitaryStrategies"); PrefetchCollection(GC.getCitySpecializationInfo(), "CitySpecializations"); PrefetchCollection(GC.getTacticalMoveInfo(), "TacticalMoves"); //BasicInfos //AnimationOperators? //Attitudes? PrefetchCollection(GC.getUnitAIInfo(), "UnitAIInfos"); PrefetchCollection(GC.getUnitCombatClassInfo(), "UnitCombatInfos"); //Buildings PrefetchCollection(GC.getBuildingClassInfo(), "BuildingClasses"); PrefetchCollection(GC.getBuildingInfo(), "Buildings"); //GameInfo PrefetchCollection(GC.getEmphasisInfo(), "EmphasizeInfos"); PrefetchCollection(GC.getEraInfo(), "Eras"); PrefetchCollection(GC.getGameOptionInfo(), "GameOptions"); PrefetchCollection(GC.getGameSpeedInfo(), "GameSpeeds"); PrefetchCollection(GC.getHandicapInfo(), "HandicapInfos"); PrefetchCollection(GC.getHurryInfo(), "HurryInfos"); PrefetchCollection(GC.getMPOptionInfo(), "MultiplayerOptions"); PrefetchCollection(GC.getPlayerOptionInfo(), "PlayerOptions"); PrefetchCollection(GC.getPolicyInfo(), "Policies"); PrefetchCollection(GC.getPolicyBranchInfo(), "PolicyBranchTypes"); PrefetchCollection(GC.getProcessInfo(), "Processes"); PrefetchCollection(GC.getProjectInfo(), "Projects"); PrefetchCollection(GC.getSmallAwardInfo(), "SmallAwards"); PrefetchCollection(GC.getSpecialistInfo(), "Specialists"); PrefetchCollection(GC.getVictoryInfo(), "Victories"); PrefetchCollection(GC.getVoteInfo(), "Votes"); PrefetchCollection(GC.getVoteSourceInfo(), "VoteSources"); #if defined(MOD_BALANCE_CORE) PrefetchCollection(GC.getEventInfo(), "Events"); PrefetchCollection(GC.getEventChoiceInfo(), "EventChoices"); PrefetchCollection(GC.getCityEventInfo(), "CityEvents"); PrefetchCollection(GC.getCityEventChoiceInfo(), "CityEventChoices"); #endif PrefetchCollection(GC.getUnitDomainInfo(), "Domains"); #if defined(MOD_EVENTS_DIPLO_MODIFIERS) PrefetchCollection(GC.getDiploModifierInfo(), "DiploModifiers"); #endif //Leaders PrefetchCollection(GC.getLeaderHeadInfo(), "Leaders"); //Misc PrefetchCollection(GC.getRouteInfo(), "Routes"); CvNotificationXMLEntries* pkNotificationEntries = GC.GetNotificationEntries(); if(pkNotificationEntries != NULL) { PrefetchCollection(pkNotificationEntries->GetNotificationEntries(), "Notifications"); } //Technologies PrefetchCollection(GC.getTechInfo(), "Technologies"); //Terrain PrefetchCollection(GC.getFeatureInfo(), "Features"); PrefetchCollection(GC.getImprovementInfo(), "Improvements"); PrefetchCollection(GC.getResourceClassInfo(), "ResourceClasses"); PrefetchCollection(GC.getResourceInfo(), "Resources"); #if defined(MOD_API_PLOT_YIELDS) if (MOD_API_PLOT_YIELDS) { PrefetchCollection(GC.getPlotInfo(), "Plots"); } #endif #if defined(MOD_API_UNIFIED_YIELDS) if (MOD_API_UNIFIED_YIELDS) { PrefetchCollection(GC.getGreatPersonInfo(), "GreatPersons"); } #endif PrefetchCollection(GC.getTerrainInfo(), "Terrains"); PrefetchCollection(GC.getYieldInfo(), "Yields"); //Units PrefetchCollection(GC.getAutomateInfo(), "Automates"); PrefetchCollection(GC.getBuildInfo(), "Builds"); PrefetchCollection(GC.getCommandInfo(), "Commands"); PrefetchCollection(GC.getControlInfo(), "Controls"); PrefetchCollection(GC.getEntityEventInfo(), "EntityEvents"); PrefetchCollection(GC.getMissionInfo(), "Missions"); PrefetchCollection(GC.getMultiUnitFormationInfo(), "MultiUnitFormations"); PrefetchCollection(GC.getSpecialUnitInfo(), "SpecialUnits"); PrefetchCollection(GC.getUnitClassInfo(), "UnitClasses"); PrefetchCollection(GC.getPromotionInfo(), "UnitPromotions"); PrefetchCollection(GC.getUnitInfo(), "Units"); //Civilizations - must be after buildings and units PrefetchCollection(GC.getCivilizationInfo(), "Civilizations"); PrefetchCollection(GC.getMinorCivInfo(), "MinorCivilizations"); PrefetchCollection(GC.getTraitInfo(), "Traits"); PrefetchCollection(GC.getReligionInfo(), "Religions"); PrefetchCollection(GC.getBeliefInfo(), "Beliefs"); PrefetchCollection(GC.getLeagueSpecialSessionInfo(), "LeagueSpecialSessions"); PrefetchCollection(GC.getLeagueNameInfo(), "LeagueNames"); PrefetchCollection(GC.getLeagueProjectInfo(), "LeagueProjects"); PrefetchCollection(GC.getLeagueProjectRewardInfo(), "LeagueProjectRewards"); PrefetchCollection(GC.getResolutionInfo(), "Resolutions"); #if defined(MOD_API_ACHIEVEMENTS) || defined(ACHIEVEMENT_HACKS) PrefetchCollection(GC.getAchievementInfo(), "Achievements"); #endif #if defined(MOD_BALANCE_CORE) // Must be after buildings because this calls from Buildings PrefetchCollection(GC.getCorporationInfo(), "Corporations"); PrefetchCollection(GC.getContractInfo(), "Contracts"); #endif //Copy flavors into string array { CvDatabaseUtility kUtility; CvString*& paFlavors = GC.getFlavorTypes(); const int iNumFlavors = kUtility.MaxRows("Flavors"); //GC.getNumFlavorTypes() = iNumFlavors; GC.setNumFlavorTypes(iNumFlavors); paFlavors = FNEW(CvString[iNumFlavors], c_eCiv5GameplayDLL, 0); Database::Results kResults; if(DB.SelectWhere(kResults, "Flavors", "ID > -1")) { while(kResults.Step()) { const int iFlavor = kResults.GetInt("ID"); CvAssert(iFlavor >= 0 && iFlavor < iNumFlavors); if(iFlavor >= 0 && iFlavor < iNumFlavors) { paFlavors[iFlavor] = kResults.GetText("Type"); } } } else { CvAssertMsg(false, DB.ErrorMessage()); } } ValidatePrefetchProcess(); return true; }