diff --git a/src/dusk/config.cpp b/src/dusk/config.cpp index e61a7a0923..31e4a80b05 100644 --- a/src/dusk/config.cpp +++ b/src/dusk/config.cpp @@ -76,15 +76,12 @@ template void ConfigImpl::loadFromJson(ConfigVar& cVar, const json& jsonValue) { if constexpr (std::is_enum_v) { if (jsonValue.is_boolean()) { + DuskConfigLog.error("Doing default migration of CVar {} from bool, enum values may not be what is expected!", cVar.getName()); + using Underlying = std::underlying_type_t; const bool b = jsonValue.get(); - Underlying raw; - if constexpr (std::is_same_v) { - raw = b ? static_cast(2) : static_cast(0); - } else { - raw = b ? static_cast(1) : static_cast(0); - } + const Underlying raw = b ? static_cast(1) : static_cast(0); cVar.setValue(sanitizeEnumValue(cVar, static_cast(raw)), false); return; @@ -194,6 +191,19 @@ namespace dusk::config { template class ConfigImpl; template class ConfigImpl; template class ConfigImpl; + + template<> void ConfigImpl::loadFromJson(ConfigVar& cVar, const json& jsonValue) { + if (jsonValue.is_boolean()) { + const bool b = jsonValue.get(); + + const FrameInterpMode mode = b ? FrameInterpMode::Unlimited : FrameInterpMode::Off; + + cVar.setValue(sanitizeEnumValue(cVar, mode), false); + return; + } + + cVar.setValue(sanitizeEnumValue(cVar, jsonValue.get()), false); + } template class ConfigImpl; template class ConfigImpl; template class ConfigImpl;