1841: Restart required message when changing Show console r=heinrich5991 a=fokkonaut



Co-authored-by: fokkonaut <35420825+fokkonaut@users.noreply.github.com>
This commit is contained in:
bors[bot] 2019-07-19 00:16:01 +00:00
commit ebeeace65e
3 changed files with 16 additions and 7 deletions

View file

@ -348,7 +348,9 @@ MACRO_CONFIG_STR(ClTimeoutCode, cl_timeout_code, 64, "", CFGFLAG_SAVE|CFGFLAG_CL
MACRO_CONFIG_STR(ClDummyTimeoutCode, cl_dummy_timeout_code, 64, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Dummy Timeout code to use") MACRO_CONFIG_STR(ClDummyTimeoutCode, cl_dummy_timeout_code, 64, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Dummy Timeout code to use")
MACRO_CONFIG_STR(ClTimeoutSeed, cl_timeout_seed, 64, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Timeout seed") MACRO_CONFIG_STR(ClTimeoutSeed, cl_timeout_seed, 64, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Timeout seed")
MACRO_CONFIG_STR(ClInputFifo, cl_input_fifo, 128, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Fifo file to use as input for client console") MACRO_CONFIG_STR(ClInputFifo, cl_input_fifo, 128, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Fifo file to use as input for client console")
#if defined(CONF_FAMILY_WINDOWS)
MACRO_CONFIG_INT(ClShowConsole, cl_show_console, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Show console window (Windows only)") MACRO_CONFIG_INT(ClShowConsole, cl_show_console, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Show console window (Windows only)")
#endif
MACRO_CONFIG_INT(InpJoystick, inp_joystick, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Try to use a joystick as input") MACRO_CONFIG_INT(InpJoystick, inp_joystick, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Try to use a joystick as input")
MACRO_CONFIG_INT(ClConfigVersion, cl_config_version, 0, 0, 0, CFGFLAG_CLIENT|CFGFLAG_SAVE, "The config version. Helps newer clients fix bugs with older configs.") MACRO_CONFIG_INT(ClConfigVersion, cl_config_version, 0, 0, 0, CFGFLAG_CLIENT|CFGFLAG_SAVE, "The config version. Helps newer clients fix bugs with older configs.")

View file

@ -127,6 +127,7 @@ class CMenus : public CComponent
static float ms_FontmodHeight; static float ms_FontmodHeight;
// for settings // for settings
bool m_NeedRestartGeneral;
bool m_NeedRestartSkins; bool m_NeedRestartSkins;
bool m_NeedRestartGraphics; bool m_NeedRestartGraphics;
bool m_NeedRestartSound; bool m_NeedRestartSound;

View file

@ -68,6 +68,11 @@ bool CMenusKeyBinder::OnInput(IInput::CEvent Event)
void CMenus::RenderSettingsGeneral(CUIRect MainView) void CMenus::RenderSettingsGeneral(CUIRect MainView)
{ {
#if defined(CONF_FAMILY_WINDOWS)
bool CheckSettings = false;
static int s_ClShowConsole = g_Config.m_ClShowConsole;
#endif
char aBuf[128]; char aBuf[128];
CUIRect Label, Button, Left, Right, Game, Client, AutoReconnect; CUIRect Label, Button, Left, Right, Game, Client, AutoReconnect;
MainView.HSplitTop(180.0f, &Game, &Client); MainView.HSplitTop(180.0f, &Game, &Client);
@ -213,7 +218,13 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
Left.HSplitTop(20.0f, 0, &Left); Left.HSplitTop(20.0f, 0, &Left);
Left.HSplitTop(20.0f, &Button, &Left); Left.HSplitTop(20.0f, &Button, &Left);
if(DoButton_CheckBox(&g_Config.m_ClShowConsole, Localize("Show console window"), g_Config.m_ClShowConsole, &Button)) if(DoButton_CheckBox(&g_Config.m_ClShowConsole, Localize("Show console window"), g_Config.m_ClShowConsole, &Button))
{
g_Config.m_ClShowConsole ^= 1; g_Config.m_ClShowConsole ^= 1;
CheckSettings = true;
}
if(CheckSettings)
m_NeedRestartGeneral = s_ClShowConsole != g_Config.m_ClShowConsole;
#endif #endif
// auto statboard screenshot // auto statboard screenshot
@ -1417,7 +1428,7 @@ void CMenus::RenderSettings(CUIRect MainView)
UI()->DoLabelScaled(&RestartWarning, Localize("DDNet Client needs to be restarted to complete update!"), 14.0f, -1); UI()->DoLabelScaled(&RestartWarning, Localize("DDNet Client needs to be restarted to complete update!"), 14.0f, -1);
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f); TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
} }
else if(m_NeedRestartSkins || m_NeedRestartGraphics || m_NeedRestartSound || m_NeedRestartDDNet) else if(m_NeedRestartGeneral || m_NeedRestartSkins || m_NeedRestartGraphics || m_NeedRestartSound || m_NeedRestartDDNet)
UI()->DoLabelScaled(&RestartWarning, Localize("You must restart the game for all settings to take effect."), 14.0f, -1); UI()->DoLabelScaled(&RestartWarning, Localize("You must restart the game for all settings to take effect."), 14.0f, -1);
} }
@ -2157,12 +2168,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
} }
if(CheckSettings) if(CheckSettings)
{ m_NeedRestartDDNet = s_InpMouseOld != g_Config.m_InpMouseOld;
if(s_InpMouseOld == g_Config.m_InpMouseOld)
m_NeedRestartDDNet = false;
else
m_NeedRestartDDNet = true;
}
CUIRect aRects[2]; CUIRect aRects[2];
Left.HSplitTop(5.0f, &Button, &Left); Left.HSplitTop(5.0f, &Button, &Left);