]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/menu.qc
On manual disconnection make sure g_campaign is reset and menu items reflect cvar...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / menu.qc
index 710dca1e6685be3d57671237bd9a1647148cfa55..8a00d713f1287186de24c77ad1710462a3310327 100644 (file)
@@ -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);