From e5b6e3eb6eff558469a7eb04c51ffcfd6535f8cf Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sun, 17 Nov 2024 21:54:24 +0100 Subject: [PATCH] ModSystem: fix unwanted double-nesting when writing status list The keyvalues file is written incorrectly as we double nest the mod list by calling FindKey on "ModList" with the create parameter set. The constructor of KeyValues already creates the root object called "ModList" in which the list should be stored. The list is now properly parsed, making the enable/disable feature for individual mods work again. --- src/pluginsystem/modsystem.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pluginsystem/modsystem.cpp b/src/pluginsystem/modsystem.cpp index 8959e7d5..e9c67846 100644 --- a/src/pluginsystem/modsystem.cpp +++ b/src/pluginsystem/modsystem.cpp @@ -135,8 +135,7 @@ void CModSystem::LoadModStatusList(CUtlMap& enabledList) //----------------------------------------------------------------------------- void CModSystem::WriteModStatusList() { - KeyValues kv = KeyValues("ModList"); - KeyValues* pModListKV = kv.FindKey("ModList", true); + KeyValues kv("ModList"); FOR_EACH_VEC(m_ModList, i) { @@ -146,7 +145,7 @@ void CModSystem::WriteModStatusList() if (mod->m_iState == eModState::ENABLED) enabled = true; - pModListKV->SetBool(mod->m_ModID.Get(), enabled); + kv.SetBool(mod->m_ModID.Get(), enabled); } CUtlBuffer buf = CUtlBuffer(ssize_t(0), 0, CUtlBuffer::TEXT_BUFFER);