Allow reloading current background entities map

This commit is contained in:
bencie 2024-08-25 18:23:25 +02:00
parent 77790f677e
commit d8e82bbb1d
3 changed files with 4 additions and 10 deletions

View file

@ -902,16 +902,11 @@ void CMenus::ConchainBackgroundEntities(IConsole::IResult *pResult, void *pUserD
if(pResult->NumArguments())
{
CMenus *pSelf = (CMenus *)pUserData;
pSelf->UpdateBackgroundEntities();
if(str_comp(g_Config.m_ClBackgroundEntities, pSelf->m_pClient->m_Background.MapName()) != 0)
pSelf->m_pClient->m_Background.LoadBackground();
}
}
void CMenus::UpdateBackgroundEntities()
{
if(str_comp(g_Config.m_ClBackgroundEntities, m_pClient->m_Background.MapName()) != 0)
m_pClient->m_Background.LoadBackground();
}
void CMenus::ConchainUpdateMusicState(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
{
pfnCallback(pResult, pCallbackUserData);

View file

@ -445,7 +445,6 @@ protected:
void RenderMenubar(CUIRect Box, IClient::EClientState ClientState);
void RenderNews(CUIRect MainView);
static void ConchainBackgroundEntities(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
void UpdateBackgroundEntities();
static void ConchainUpdateMusicState(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
void UpdateMusicState();

View file

@ -3229,7 +3229,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
if(DoButton_FontIcon(&s_BackgroundEntitiesReload, FONT_ICON_ARROW_ROTATE_RIGHT, 0, &ReloadButton))
{
UpdateBackgroundEntities();
m_pClient->m_Background.LoadBackground();
}
if(DoButton_FontIcon(&s_BackgroundEntitiesMapPicker, FONT_ICON_FOLDER, 0, &Button))
@ -3402,7 +3402,7 @@ CUi::EPopupMenuFunctionResult CMenus::PopupMapPicker(void *pContext, CUIRect Vie
else
{
str_format(g_Config.m_ClBackgroundEntities, sizeof(g_Config.m_ClBackgroundEntities), "%s/%s", pPopupContext->m_aCurrentMapFolder, SelectedItem.m_aFilename);
pMenus->UpdateBackgroundEntities();
pMenus->m_pClient->m_Background.LoadBackground();
return CUi::POPUP_CLOSE_CURRENT;
}
}