bool ScenarioLoadForCacheBuild(cstring scenario_name) { // NOTE: the Scenario::GetYelo(), etc APIs won't be valid until the call to scenario_load datum_index scenario_index = blam::tag_load<TagGroups::scenario>(scenario_name, FLAG(Flags::_tag_load_from_file_system_bit)); // the engine code returns true even if the tags fail to load if (scenario_index.IsNull()) return true; auto* scenario = blam::tag_get<TagGroups::scenario>(scenario_index); // perform the initial project_yellow fixups and associated changes here if (BuildCacheFileForYelo()) { const tag_reference& yelo_reference = scenario->GetYeloReferenceHack(); FixScenarioYelo(yelo_reference.tag_index); InitializeYeloCacheHeaderForNewScenario(scenario, yelo_reference.tag_index); } // they use non-resolving references as FixGameGlobals clears select tag blocks for certain scenario types, // thus any references the blocks have wouldn't need to be used datum_index globals_index = blam::tag_load<TagGroups::s_game_globals>(Scenario::K_GAME_GLOBALS_TAG_NAME, FLAG(Flags::_tag_load_from_file_system_bit) | FLAG(Flags::_tag_load_non_resolving_references_bit)); // the engine code returns true even if the tags fail to load if (globals_index.IsNull()) return true; FixGameGlobals(globals_index, scenario->type); // the child of the globals tags can now be loaded, as all unnecessary references have been cleared blam::tag_load_children(globals_index); return blam::scenario_load(scenario_name); }
bool ScenarioLoadForCacheBuild(cstring scenario_name, cstring globals_name) { datum_index scenario_index = tag_load<TagGroups::scenario>(scenario_name, FLAG(Flags::_tag_load_verify_exist_first_bit)); datum_index globals_index = tag_load<TagGroups::s_game_globals>(globals_name, FLAG(Flags::_tag_load_verify_exist_first_bit) | FLAG(Flags::_tag_load_non_resolving_references_bit)); // the engine code returns true even if the tags fail to load if(scenario_index.IsNull() || globals_index.IsNull()) return true; TagGroups::scenario* scnr = tag_get<TagGroups::scenario>(scenario_index); FixGameGlobals(globals_index, scnr->type); tag_load_children(globals_index); return true; }