From 04e8d00daa794f18f1c04f705f5559930d23dfdf Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Fri, 24 May 2024 09:07:54 +0200 Subject: [PATCH] fix invalid default initialization in SettingsMap --- include/Settings.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/include/Settings.h b/include/Settings.h index 071088c..5c39e5e 100644 --- a/include/Settings.h +++ b/include/Settings.h @@ -86,17 +86,18 @@ struct Settings { }; Sync> SettingsMap = std::unordered_map { - { General_Description, "BeamMP Default Description" }, - { General_Tags, "Freeroam" }, + // All entries which contain std::strings must be explicitly constructed, otherwise they become 'bool' + { General_Description, std::string("BeamMP Default Description") }, + { General_Tags, std::string("Freeroam") }, { General_MaxPlayers, 8 }, - { General_Name, "BeamMP Server" }, - { General_Map, "/levels/gridmap_v2/info.json" }, - { General_AuthKey, "" }, + { General_Name, std::string("BeamMP Server") }, + { General_Map, std::string("/levels/gridmap_v2/info.json") }, + { General_AuthKey, std::string("") }, { General_Private, true }, { General_Port, 30814 }, { General_MaxCars, 1 }, { General_LogChat, true }, - { General_ResourceFolder, "Resources" }, + { General_ResourceFolder, std::string("Resources") }, { General_Debug, false }, { Misc_SendErrorsShowMessage, true }, { Misc_SendErrors, true }, @@ -183,7 +184,7 @@ TEST_CASE("settings get/set") { CHECK_EQ(settings.getAsInt(Settings::General_MaxPlayers), 12); } -TEST_CASE("settings check for exception on wrong input type"){ +TEST_CASE("settings check for exception on wrong input type") { Settings settings; CHECK_THROWS(settings.set(Settings::General_Debug, "hello, world")); CHECK_NOTHROW(settings.set(Settings::General_Debug, false));