Skip to content

Commit 157a311

Browse files
authored
Reload CLEO config on new game session (#555)
1 parent 87410d7 commit 157a311

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

source/CConfigManager.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,13 @@ namespace CLEO
217217
ini.LoadFile(path);
218218
}
219219

220+
void CConfigManager::Reset()
221+
{
222+
iniLoaded = false;
223+
cache.clear();
224+
ini.Reset();
225+
}
226+
220227
bool CConfigManager::SaveIni()
221228
{
222229
std::ofstream out(GetConfigPath(), std::ios::binary);

source/CConfigManager.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ namespace CLEO
2323
// Get config file path
2424
static const char* GetConfigPath();
2525

26+
// Clears the cached values and forces a re-read from disk on next access
27+
static void Reset();
28+
2629
private:
2730
static CSimpleIniA ini;
2831
static bool iniLoaded;

source/CleoBase.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ namespace CLEO
220220
if (m_bGameInProgress) return;
221221
m_bGameInProgress = true;
222222

223+
CConfigManager::Reset(); // re-read config file to apply any user changes made in background
224+
223225
CleoInstance.saveSlot = saveSlot;
224226
TRACE("Starting new game session, save slot: %d", saveSlot);
225227

0 commit comments

Comments
 (0)