From 0f09ca29f93a06da390af43aad0bac048b763989 Mon Sep 17 00:00:00 2001 From: terencehill Date: Fri, 8 Apr 2022 17:01:56 +0200 Subject: [PATCH] Rearrange code to avoid redundant checks --- qcsrc/menu/menu.qc | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/qcsrc/menu/menu.qc b/qcsrc/menu/menu.qc index f2a71d967..efed9ff2e 100644 --- a/qcsrc/menu/menu.qc +++ b/qcsrc/menu/menu.qc @@ -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; } -- 2.39.2