]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Show the list of available options for menu_cmd directmenu and menu_cmd directpanelhu...
authorterencehill <piuntn@gmail.com>
Sun, 29 Jan 2012 15:13:40 +0000 (16:13 +0100)
committerterencehill <piuntn@gmail.com>
Sun, 29 Jan 2012 15:13:40 +0000 (16:13 +0100)
qcsrc/menu/command/menu_cmd.qc

index 3be6edc6629612eda6aca51ce768e850bd48c7bf..aa68f2c1bc591dd7fab34aaf76c2ea44798f199a 100644 (file)
@@ -77,18 +77,37 @@ void GameCommand(string theCommand)
                return;
        }
 
-       if(argv(0) == "directmenu") if(argc == 2)
+       if(argv(0) == "directmenu" || argv(0) == "directpanelhudmenu")
        {
-               // switch to a menu item
-               if(!isdemo()) // don't allow this command in demos
-                       m_goto(argv(1));
-               return;
-       }
+               string filter;
+               if(argv(0) == "directpanelhudmenu")
+                       filter = strzone("HUD");
 
-       if(argv(0) == "directpanelhudmenu")
-       {
-               // switch to a menu item
-               m_goto(strcat("HUD", argv(1)));
+               if(argc == 1)
+               {
+                       print(_("Available options:\n"));
+                       float i;
+                       entity e;
+                       string s;
+
+                       for(i = 0, e = world; (e = nextent(e)); )
+                               if(e.classname != "vtbl" && e.name != "")
+                               {
+                                       s = e.name;
+                                       if(filter)
+                                       {
+                                               if(substring(s, 0, strlen(filter)) != filter)
+                                                       continue;
+                                               s = substring(s, strlen(filter), strlen(s) - strlen(filter));
+                                       }
+                                       print(strcat(" ", s ,"\n"));
+                                       ++i;
+                               }
+               }
+               else if(argc == 2 && !isdemo()) // don't allow this command in demos
+                       m_goto(strcat(filter, argv(1))); // switch to a menu item
+               if(filter)
+                       strunzone(filter);
                return;
        }