From: terencehill Date: Fri, 8 Apr 2022 15:01:56 +0000 (+0200) Subject: Rearrange code to avoid redundant checks X-Git-Tag: xonotic-v0.8.5~99 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0f09ca29f93a06da390af43aad0bac048b763989;p=xonotic%2Fxonotic-data.pk3dir.git Rearrange code to avoid redundant checks --- 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; }