}
float autocvar_menu_force_on_disconnection;
+bool autocvar_g_campaign;
void m_draw(float width, float height)
{
if (autocvar_menu_force_on_disconnection > 0)
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);
// 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;