From: terencehill Date: Sat, 29 Aug 2015 19:48:36 +0000 (+0200) Subject: Fallback to default quickmenu if quickmenu file can't be loaded X-Git-Tag: xonotic-v0.8.2~1987^2~4 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c4ef31fba059c65bedaba56ed7c0faa71b388e8f;p=xonotic%2Fxonotic-data.pk3dir.git Fallback to default quickmenu if quickmenu file can't be loaded --- diff --git a/qcsrc/client/quickmenu.qc b/qcsrc/client/quickmenu.qc index 597722469..0f00fdc5b 100644 --- a/qcsrc/client/quickmenu.qc +++ b/qcsrc/client/quickmenu.qc @@ -62,6 +62,20 @@ bool QuickMenu_Open(string mode, string submenu) mode = "file"; } + if(mode == "file") + { + if(autocvar_hud_panel_quickmenu_file == "" || autocvar_hud_panel_quickmenu_file == "0") + printf("No file name is set in hud_panel_quickmenu_file, loading default quickmenu\n"); + else + { + fh = fopen(autocvar_hud_panel_quickmenu_file, FILE_READ); + if(fh < 0) + printf("Couldn't open file \"%s\", loading default quickmenu\n", autocvar_hud_panel_quickmenu_file); + } + if(fh < 0) + mode = "default"; + } + if(mode == "default") { QuickMenu_Buffer = buf_create(); @@ -72,15 +86,6 @@ bool QuickMenu_Open(string mode, string submenu) } else if(mode == "file") { - if(autocvar_hud_panel_quickmenu_file != "") - if(autocvar_hud_panel_quickmenu_file != "0") - fh = fopen(autocvar_hud_panel_quickmenu_file, FILE_READ); - if(fh < 0) - { - printf("Couldn't open file \"%s\"\n", autocvar_hud_panel_quickmenu_file); - return false; - } - QuickMenu_Buffer = buf_create(); if(QuickMenu_Buffer < 0) {