]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fallback to default quickmenu if quickmenu file can't be loaded
authorterencehill <piuntn@gmail.com>
Sat, 29 Aug 2015 19:48:36 +0000 (21:48 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 29 Aug 2015 19:48:36 +0000 (21:48 +0200)
qcsrc/client/quickmenu.qc

index 5977224699f7eae5e6934721c1c5e10fb3ce1fb5..0f00fdc5b0367d0014e093bcf6a288fbfec475fd 100644 (file)
@@ -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)
                {