MCPcopy Create free account
hub / github.com/crossuo/crossuo / Load

Method Load

src/Managers/ConfigManager.cpp:1002–1546  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1000}
1001
1002bool CConfigManager::Load(const fs_path &path)
1003{
1004 if (!fs_path_exists(path))
1005 {
1006 return false;
1007 }
1008
1009 int screenX, screenY;
1010 GetDisplaySize(&screenX, &screenY);
1011 screenX -= 20;
1012 screenY -= 60;
1013
1014 TextFileParser file(path, "=", "#;", "");
1015
1016 bool zoomed = false;
1017 int windowX = -1;
1018 int windowY = -1;
1019 int windowWidth = -1;
1020 int windowHeight = -1;
1021 UpdateRange = g_MaxViewRange;
1022 auto contPos = ContainerDefaultPosition();
1023
1024 while (!file.IsEOF())
1025 {
1026 auto strings = file.ReadTokens();
1027 if (strings.size() >= 2)
1028 {
1029 const int code = cmkc::GetConfigKey(strings[0]);
1030 if (code == CMKC_NONE)
1031 {
1032 continue;
1033 }
1034
1035 switch (code)
1036 {
1037 //Page 1
1038 case CMKC_SOUND:
1039 SetSound(str_to_bool(strings[1]));
1040 break;
1041 case CMKC_SOUND_VOLUME:
1042 m_SoundVolume = str_to_int(strings[1]);
1043 break;
1044 case CMKC_MUSIC:
1045 SetMusic(str_to_bool(strings[1]));
1046 break;
1047 case CMKC_MUSIC_VOLUME:
1048 m_MusicVolume = str_to_int(strings[1]);
1049 break;
1050 case CMKC_FOOTSTEPS_SOUND:
1051 FootstepsSound = str_to_bool(strings[1]);
1052 break;
1053 case CMKC_COMBAT_MUSIC:
1054 CombatMusic = str_to_bool(strings[1]);
1055 break;
1056 case CMKC_BACKGROUND_SOUND:
1057 BackgroundSound = str_to_bool(strings[1]);
1058 break;
1059

Callers

nothing calls this directly

Calls 15

fs_path_existsFunction · 0.85
GetDisplaySizeFunction · 0.85
str_to_boolFunction · 0.85
str_to_intFunction · 0.85
SDL_GetWindowSizeFunction · 0.85
HACKRender_SetViewParamsFunction · 0.85
ReadTokensMethod · 0.80
SetMaximizedMethod · 0.80
SetPositionSizeMethod · 0.80
UpdateRectMethod · 0.80
RedrawAllMethod · 0.80
GetConfigKeyFunction · 0.70

Tested by

no test coverage detected