From 2868b3cdf661e02e77c14d591385e9c5660bdb21 Mon Sep 17 00:00:00 2001 From: bencie Date: Thu, 29 Feb 2024 18:13:50 +0100 Subject: [PATCH 1/2] Let users pick background entities map without file extensions --- src/game/client/components/background.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/client/components/background.cpp b/src/game/client/components/background.cpp index 425ec5bf6..065f0da03 100644 --- a/src/game/client/components/background.cpp +++ b/src/game/client/components/background.cpp @@ -60,7 +60,7 @@ void CBackground::LoadBackground() bool NeedImageLoading = false; char aBuf[IO_MAX_PATH_LENGTH]; - str_format(aBuf, sizeof(aBuf), "maps/%s", g_Config.m_ClBackgroundEntities); + str_format(aBuf, sizeof(aBuf), str_endswith_nocase(g_Config.m_ClBackgroundEntities, ".map") ? "maps/%s" : "maps/%s.map", g_Config.m_ClBackgroundEntities); if(str_comp(g_Config.m_ClBackgroundEntities, CURRENT_MAP) == 0) { m_pMap = Kernel()->RequestInterface(); From 26cc7dde2ffef927d721c43ec79dabadf2554477 Mon Sep 17 00:00:00 2001 From: bencie Date: Thu, 29 Feb 2024 18:37:39 +0100 Subject: [PATCH 2/2] Refactor --- src/game/client/components/background.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/client/components/background.cpp b/src/game/client/components/background.cpp index 065f0da03..1d7c41c61 100644 --- a/src/game/client/components/background.cpp +++ b/src/game/client/components/background.cpp @@ -60,7 +60,7 @@ void CBackground::LoadBackground() bool NeedImageLoading = false; char aBuf[IO_MAX_PATH_LENGTH]; - str_format(aBuf, sizeof(aBuf), str_endswith_nocase(g_Config.m_ClBackgroundEntities, ".map") ? "maps/%s" : "maps/%s.map", g_Config.m_ClBackgroundEntities); + str_format(aBuf, sizeof(aBuf), "maps/%s%s", g_Config.m_ClBackgroundEntities, str_endswith(g_Config.m_ClBackgroundEntities, ".map") ? "" : ".map"); if(str_comp(g_Config.m_ClBackgroundEntities, CURRENT_MAP) == 0) { m_pMap = Kernel()->RequestInterface();