From 65d22406a3a642b6a4b53734f28d830748d708b0 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sun, 10 Oct 2021 11:57:09 +1000 Subject: [PATCH] SettingsWrapper: Fix enums being stored as ints --- common/SettingsWrapper.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/common/SettingsWrapper.cpp b/common/SettingsWrapper.cpp index 3f4ca58e85..6656715066 100644 --- a/common/SettingsWrapper.cpp +++ b/common/SettingsWrapper.cpp @@ -166,15 +166,6 @@ int SettingsSaveWrapper::EntryBitfield(const char* section, const char* var, int void SettingsSaveWrapper::_EnumEntry(const char* section, const char* var, int& value, const char* const* enumArray, int defvalue) { const int cnt = _calcEnumLength(enumArray); - if (value >= cnt) - { - Console.Warning("(SaveSettings) An illegal enumerated index was detected when saving '%s'", var); - Console.Indent().Warning( - "Illegal Value: %d\n" - "Using Default: %d (%s)\n", - value, defvalue, enumArray[defvalue]); - value = defvalue; - } - - m_si.SetIntValue(section, var, value); + const int index = (value < 0 || value >= cnt) ? defvalue : value; + m_si.SetStringValue(section, var, enumArray[index]); }