make maplist work over rcon

This commit is contained in:
Bill Currie 2002-09-04 18:56:53 +00:00
parent 4373e4b4de
commit 5597dc2408
3 changed files with 10 additions and 7 deletions

View file

@ -101,6 +101,7 @@ void Con_BasicCompleteCommandLine (inputline_t *il);
// Generic libs/util/console.c function to display a list // Generic libs/util/console.c function to display a list
// formatted in columns on the console // formatted in columns on the console
void Con_DisplayList(const char **list, int con_linewidth); void Con_DisplayList(const char **list, int con_linewidth);
extern void (*con_list_print)(const char *fmt, ...);
inputline_t *Con_CreateInputLine (int lines, int lsize, char prompt); inputline_t *Con_CreateInputLine (int lines, int lsize, char prompt);
void Con_DestroyInputLine (inputline_t *inputline); void Con_DestroyInputLine (inputline_t *inputline);

View file

@ -39,6 +39,7 @@ static const char rcsid[] =
#include "QF/console.h" #include "QF/console.h"
void (*con_list_print)(const char *fmt, ...) = Con_Printf;
/* /*
Con_DisplayList Con_DisplayList
@ -49,14 +50,14 @@ static const char rcsid[] =
*/ */
void void
Con_DisplayList(const char **list, int con_linewidth) Con_DisplayList (const char **list, int con_linewidth)
{ {
const char **walk = list; const char **walk = list;
int len = 0, maxlen = 0, pos =0, i = 0; int len = 0, maxlen = 0, pos =0, i = 0;
int width = (con_linewidth - 4); int width = (con_linewidth - 4);
while (*walk) { while (*walk) {
len = strlen(*walk); len = strlen (*walk);
if (len > maxlen) if (len > maxlen)
maxlen = len; maxlen = len;
walk++; walk++;
@ -64,20 +65,20 @@ Con_DisplayList(const char **list, int con_linewidth)
maxlen += 1; maxlen += 1;
while (*list) { while (*list) {
len = strlen(*list); len = strlen (*list);
if (pos + maxlen >= width) { if (pos + maxlen >= width) {
Con_Printf("\n"); con_list_print ("\n");
pos = 0; pos = 0;
} }
Con_Printf("%s", *list); con_list_print ("%s", *list);
for (i = 0; i < (maxlen - len); i++) for (i = 0; i < (maxlen - len); i++)
Con_Printf(" "); con_list_print (" ");
pos += maxlen; pos += maxlen;
list++; list++;
} }
if (pos) if (pos)
Con_Printf("\n\n"); con_list_print ("\n\n");
} }

View file

@ -2462,6 +2462,7 @@ SV_Init (void)
Con_Init (sv_console_plugin->string); Con_Init (sv_console_plugin->string);
if (con_module) if (con_module)
con_module->data->console->cbuf = sv_cbuf; con_module->data->console->cbuf = sv_cbuf;
con_list_print = Sys_Printf;
Sys_SetStdPrintf (SV_Print); Sys_SetStdPrintf (SV_Print);
Sys_SetErrPrintf (SV_Error); Sys_SetErrPrintf (SV_Error);