MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / mods_load

Method mods_load

ogsr_engine/xr_3da/Environment_misc.cpp:692–754  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

690}
691
692void CEnvironment::mods_load()
693{
694 Modifiers.clear();
695
696 string_path path;
697
698 if (FS.exist(path, fsgame::level, fsgame::level_files::level_env_mod_ltx))
699 {
700 CInifile ltXfile = CInifile(path);
701
702 for (const auto& it : ltXfile.sections())
703 {
704 CEnvModifier E;
705 if (E.loadIni(ltXfile, it.first.c_str()))
706 Modifiers.push_back(E);
707 }
708 }
709 else if (FS.exist(path, fsgame::level, fsgame::level_files::level_env_mod))
710 {
711 IReader* fs = FS.r_open(path);
712
713 {
714 u32 id = 0;
715 u32 ver = 0x0015;
716 u32 sz;
717
718 while (0 != (sz = fs->find_chunk(id)))
719 {
720 if (id == 0 && sz == sizeof(u32))
721 {
722 ver = fs->r_u32();
723 }
724 else
725 {
726 CEnvModifier E;
727 if (E.load(fs, ver))
728 {
729 Modifiers.push_back(E);
730 }
731 }
732 id++;
733 }
734 }
735
736 FS.r_close(fs);
737
738 if (!Modifiers.empty() && bLevelEnvModExport)
739 {
740 FS.update_path(path, fsgame::level, fsgame::level_files::level_env_mod_ltx);
741
742 CInifile ltXfile{path, 0, 0, 1};
743 u32 id{};
744
745 for (auto& mod : Modifiers)
746 {
747 mod.saveIni(ltXfile, std::to_string(id++).c_str());
748 }
749 }

Callers 1

LoadMethod · 0.80

Calls 15

to_stringFunction · 0.85
existMethod · 0.80
r_openMethod · 0.80
find_chunkMethod · 0.80
r_closeMethod · 0.80
CInifileClass · 0.50
clearMethod · 0.45
loadIniMethod · 0.45
c_strMethod · 0.45
push_backMethod · 0.45
r_u32Method · 0.45
loadMethod · 0.45

Tested by

no test coverage detected