From: divverent Date: Wed, 6 Feb 2008 18:44:53 +0000 (+0000) Subject: make "set con_completion_commandname map" a command complete as if it were the "map... X-Git-Tag: xonotic-v0.1.0preview~2438 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8d76d1ea345e97756179a6d15f3e101fc370a1b7;p=xonotic%2Fdarkplaces.git make "set con_completion_commandname map" a command complete as if it were the "map" command git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8078 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/console.c b/console.c index e153b5ed..8abc906a 100644 --- a/console.c +++ b/console.c @@ -2202,7 +2202,7 @@ void Con_CompleteCommandLine (void) char command[512]; int c, v, a, i, cmd_len, pos, k; int n; // nicks --blub - const char *space; + const char *space, *patterns; //find what we want to complete pos = key_linepos; @@ -2222,7 +2222,12 @@ void Con_CompleteCommandLine (void) if(space && pos == (space - key_lines[edit_line]) + 1) { strlcpy(command, key_lines[edit_line] + 1, min(sizeof(command), (unsigned int)(space - key_lines[edit_line]))); - if(!strcmp(command, "map") || !strcmp(command, "changelevel")) + + patterns = Cvar_VariableString(va("con_completion_%s", command)); // TODO maybe use a better place for this? + if(patterns && !*patterns) + patterns = NULL; // get rid of the empty string + + if(!strcmp(command, "map") || !strcmp(command, "changelevel") || (patterns && !strcmp(patterns, "map"))) { //maps search char t[MAX_QPATH]; @@ -2244,9 +2249,7 @@ void Con_CompleteCommandLine (void) } else { - const char *patterns = Cvar_VariableString(va("con_completion_%s", command)); // TODO maybe use a better place for this? - - if(patterns && *patterns) + if(patterns) { char t[MAX_QPATH]; stringlist_t resultbuf, dirbuf;