]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Rearrange code to avoid redundant checks
authorterencehill <piuntn@gmail.com>
Fri, 8 Apr 2022 15:01:56 +0000 (17:01 +0200)
committerterencehill <piuntn@gmail.com>
Fri, 8 Apr 2022 15:01:56 +0000 (17:01 +0200)
qcsrc/menu/menu.qc

index f2a71d9679f879f1c0564a9ed107456eb43ee29a..efed9ff2eac775a806e2f114e67d8e185069bedb 100644 (file)
@@ -680,9 +680,9 @@ void m_draw(float width, float height)
        static float connected_time;
        if (clientstate() == CS_DISCONNECTED)
        {
-               if (autocvar_g_campaign)
+               if (connected_time && time - connected_time > MIN_DISCONNECTION_TIME)
                {
-                       if (connected_time && time - connected_time > MIN_DISCONNECTION_TIME)
+                       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
@@ -690,16 +690,8 @@ void m_draw(float width, float height)
                                cvar_set("g_campaign", "0");
                                m_sync();
                        }
-               }
-               if (autocvar_menu_force_on_disconnection > 0)
-               {
-                       if (connected_time && time - connected_time > MIN_DISCONNECTION_TIME)
-                       {
+                       if (autocvar_menu_force_on_disconnection > 0)
                                m_toggle(true);
-                       }
-               }
-               if (connected_time && time - connected_time > MIN_DISCONNECTION_TIME)
-               {
                        localcmd("\nmenu_cmd directmenu Welcome RESET\n");
                        connected_time = 0;
                }