From: terencehill Date: Mon, 3 May 2021 23:29:21 +0000 (+0200) Subject: On manual disconnection make sure g_campaign is reset and menu items reflect cvar... X-Git-Tag: xonotic-v0.8.5~129^2~22 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e046ae8e0d34d670e3e2617ac18e354ef399f11a;p=xonotic%2Fxonotic-data.pk3dir.git On manual disconnection make sure g_campaign is reset and menu items reflect cvar values that may have been restored after quitting the campaign --- diff --git a/qcsrc/menu/menu.qc b/qcsrc/menu/menu.qc index 710dca1e6..8a00d713f 100644 --- a/qcsrc/menu/menu.qc +++ b/qcsrc/menu/menu.qc @@ -673,6 +673,7 @@ void m_tooltip(vector pos) } float autocvar_menu_force_on_disconnection; +bool autocvar_g_campaign; void m_draw(float width, float height) { if (autocvar_menu_force_on_disconnection > 0) @@ -680,6 +681,14 @@ void m_draw(float width, float height) static float connected_time; if (clientstate() == CS_DISCONNECTED) { + if (autocvar_g_campaign) + { + // in the case player uses the disconnect command (in the console or with a key) + // reset g_campaign and update menu items to reflect cvar values that may have been restored after quiting the campaign + // see also QUITGAME_CMD + cvar_set("g_campaign", "0"); + m_sync(); + } if (connected_time && time - connected_time > autocvar_menu_force_on_disconnection) { m_toggle(true); diff --git a/qcsrc/menu/menu.qh b/qcsrc/menu/menu.qh index d4c8ea6ba..239c66152 100644 --- a/qcsrc/menu/menu.qh +++ b/qcsrc/menu/menu.qh @@ -18,7 +18,8 @@ int gamestatus; // resets g_campaign and updates menu items to reflect cvar values that may have been restored after leaving the campaign // the delay is for allowing listening to the button sound (if enabled), since the disconnect command stops all sounds // menu_sync is also useful when quitting Instant Action mode -const string QUITGAME_CMD = "defer 0.4 disconnect; defer 0.4 wait; defer 0.4 \"g_campaign 0\"; defer 0.4 menu_sync"; +// see also m_draw +const string QUITGAME_CMD = "defer 0.4 disconnect; defer 0.4 wait; defer 0.4 \"g_campaign 0\"; defer 0.4 menu_sync\n"; const int S_SHIFT = 1; const int S_CTRL = 2;