Merge branch 'master' into terencehill/menu_quit_game
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / command / menu_cmd.qc
index ce682de004af0d6bfbfef7f87576f19460fe48d6..b56e8e9e4afd4ba69e8047d6afbdc04cd64119d7 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <common/command/_mod.qh>
 
+.void(entity me, int argsbuf) readInputArgs;
 .entity firstChild, nextSibling;
 
 string _dumptree_space;
@@ -97,6 +98,27 @@ void GameCommand(string theCommand)
                        m_play_click_sound(MENU_SOUND_OPEN);
                        m_goto(strcat(filter, argv(1))); // switch to a menu item
                }
+               else if(argc > 2 && !isdemo())
+               {
+                       entity e = NULL;
+                       float argsbuf = 0;
+                       string s = strzone(argv(1)); // dialog name
+                       for(int i = 0; (e = nextent(e)); )
+                               if(e.classname != "vtbl" && e.name == strcat(filter, s))
+                               {
+                                       argsbuf = buf_create();
+                                       if(argsbuf >= 0)
+                                       if(e.readInputArgs)
+                                       {
+                                               for(i = 2; i < argc; ++i)
+                                                       bufstr_add(argsbuf, argv(i), 1);
+                                               e.readInputArgs(e, argsbuf);
+                                               m_goto(strcat(filter, s));
+                                       }
+                                       if(argsbuf >= 0)
+                                               buf_del(argsbuf);
+                               }
+               }
                return;
        }