fix the server console for static builds (hmm, non-curses only?)

This commit is contained in:
Bill Currie 2001-12-02 20:11:21 +00:00
parent ce9e2e62e3
commit a619739bab
8 changed files with 51 additions and 8 deletions

View file

@ -133,6 +133,10 @@
/* Define this if you want progs typechecking */
#undef TYPECHECK_PROGS
/* list of server plugins and prototypes */
#undef SERVER_PLUGIN_LIST
#undef SERVER_PLUGIN_PROTOS
/* list of cd plugins and prototypes */
#undef CD_PLUGIN_LIST
#undef CD_PLUGIN_PROTOS

View file

@ -1603,6 +1603,8 @@ else
fi
PLUGIN_RPATH='-rpath $(plugindir)'
SERVER_PLUGIN_TARGETS="libconsole_server.la"
SERVER_PLUGIN_STATIC=""
CD_PLUGIN_STATIC=""
SND_PLUGIN_STATIC=""
SND_REND_STATIC=""
@ -1615,6 +1617,8 @@ if test "x$static_plugins" = xauto -a "x$SYSTYPE" = xWIN32; then
fi
if test "x$static_plugins" = xyes; then
PLUGIN_RPATH=''
SERVER_PLUGIN_STATIC="$SERVER_PLUGIN_TARGETS"
SERVER_PLUGIN_TARGETS=""
CD_PLUGIN_STATIC="$CD_PLUGIN_TARGETS"
CD_PLUGIN_TARGETS=""
SND_PLUGIN_STATIC="$SND_PLUGIN_TARGETS"
@ -1626,15 +1630,24 @@ if test "x$static_plugins" = xyes; then
CDTYPE="$CDTYPE (static)"
fi
fi
SERVER_PLUGIN_STATIC_LIBS=""
CD_PLUGIN_STATIC_LIBS=""
SND_PLUGIN_STATIC_LIBS=""
SND_REND_STATIC_LIBS=""
SERVER_PLUGIN_LIST="{0, 0}"
CD_PLUGIN_LIST="{0, 0}"
SND_OUTPUT_LIST="{0, 0}"
SND_RENDER_LIST="{0, 0}"
SERVER_PLUGIN_PROTOS=""
CD_PLUGIN_PROTOS=""
SND_OUTPUT_PROTOS=""
SND_RENDER_PROTOS=""
for l in $SERVER_PLUGIN_STATIC; do
SERVER_PLUGIN_STATIC_LIBS="$SERVER_PLUGIN_STATIC_LIBS "'$(top_builddir)'"/libs/console/$l"
n="`echo $l | sed -e 's/.*lib\(.*\)\.la/\1/'`"
SERVER_PLUGIN_LIST='{"'"$n"'"'", ${n}_PluginInfo},$SERVER_PLUGIN_LIST"
SERVER_PLUGIN_PROTOS="$SERVER_PLUGIN_PROTOS extern QFPLUGIN plugin_t *${n}_PluginInfo (void);"
done
for l in $CD_PLUGIN_STATIC; do
CD_PLUGIN_STATIC_LIBS="$CD_PLUGIN_STATIC_LIBS cd/$l"
n="`echo $l | sed -e 's/lib\(.*\)\.la/\1/'`"
@ -1653,6 +1666,8 @@ for l in $SND_REND_STATIC; do
SND_RENDER_LIST='{"'"$n"'"'", ${n}_PluginInfo},$SND_RENDER_LIST"
SND_RENDER_PROTOS="$SND_RENDER_PROTOS extern QFPLUGIN plugin_t *${n}_PluginInfo (void);"
done
AC_DEFINE_UNQUOTED(SERVER_PLUGIN_LIST, $SERVER_PLUGIN_LIST)
AC_DEFINE_UNQUOTED(SERVER_PLUGIN_PROTOS, $SERVER_PLUGIN_PROTOS)
AC_DEFINE_UNQUOTED(CD_PLUGIN_LIST, $CD_PLUGIN_LIST)
AC_DEFINE_UNQUOTED(CD_PLUGIN_PROTOS, $CD_PLUGIN_PROTOS)
AC_DEFINE_UNQUOTED(SND_OUTPUT_LIST, $SND_OUTPUT_LIST)
@ -1663,6 +1678,9 @@ AC_DEFINE_UNQUOTED(SND_RENDER_PROTOS, $SND_RENDER_PROTOS)
AC_SUBST(NQ_TARGETS)
AC_SUBST(QW_TARGETS)
AC_SUBST(PLUGIN_RPATH)
AC_SUBST(SERVER_PLUGIN_STATIC)
AC_SUBST(SERVER_PLUGIN_STATIC_LIBS)
AC_SUBST(SERVER_PLUGIN_TARGETS)
AC_SUBST(CD_PLUGIN_STATIC)
AC_SUBST(CD_PLUGIN_STATIC_LIBS)
AC_SUBST(CD_PLUGIN_TARGETS)

View file

@ -3,7 +3,9 @@ AUTOMAKE_OPTIONS= foreign
INCLUDES= -I$(top_srcdir)/include
lib_LTLIBRARIES= libQFconsole.la
plugin_LTLIBRARIES= libconsole_server.la #libconsole_client.la
plugin_LTLIBRARIES= @SERVER_PLUGIN_TARGETS@ #libconsole_client.la
noinst_LTLIBRARIES= @SERVER_PLUGIN_STATIC@
EXTRA_LTLIBRARIES= libconsole_server.la
common_sources= buffer.c complete.c console.c inputline.c list.c filelist.c
client_sources= client.c
@ -16,6 +18,6 @@ libQFconsole_la_SOURCES= $(common_sources)
#libconsole_client_la_LDFLAGS= -version-info 1:0:0
#libconsole_client_la_SOURCES= $(client_sources)
libconsole_server_la_LDFLAGS= $(plugin_LDFLAGS) -version-info 1:0:0
libconsole_server_la_LDFLAGS= $(plugin_LDFLAGS) -version-info 1:0:0 $(PLUGIN_RPATH)
libconsole_server_la_LIBADD= $(CURSES_LIBS) $(plugin_LIBADD)
libconsole_server_la_SOURCES= $(server_sources)

View file

@ -108,8 +108,14 @@ Con_DPrintf (const char *fmt, ...)
void
Con_ProcessInput (void)
{
if (con_module)
if (con_module) {
con_module->functions->console->pC_ProcessInput ();
else
Con_Printf ("no input for you\n");
} else {
static int been_there_done_that = 0;
if (!been_there_done_that) {
been_there_done_that = 1;
Con_Printf ("no input for you\n");
}
}
}

View file

@ -305,13 +305,18 @@ C_Print (const char *fmt, va_list args)
static int buffer_size;
size = vsnprintf (buffer, buffer_size, fmt, args) + 1; // +1 for nul
if (size > buffer_size) {
buffer_size = (size + 1023) & ~1023; // 1k multiples
//printf ("size = %d\n", size);
while (size <= 0 || size > buffer_size) {
if (size > 0)
buffer_size = (size + 1023) & ~1023; // 1k multiples
else
buffer_size += 1024;
buffer = realloc (buffer, buffer_size);
if (!buffer)
Sys_Error ("console: could not allocate %d bytes\n",
buffer_size);
vsnprintf (buffer, buffer_size, fmt, args);
size = vsnprintf (buffer, buffer_size, fmt, args);
//printf ("size = %d\n", size);
}
txt = buffer;

View file

@ -71,6 +71,7 @@ client_LIBFILES= \
$(top_builddir)/libs/console/filelist.o
server_LIBFILES= \
$(SERVER_PLUGIN_STATIC_LIBS) \
$(top_builddir)/libs/models/libQFmodels.la \
$(top_builddir)/libs/console/libQFconsole.la

View file

@ -82,6 +82,7 @@ server_sources= crudefile.c sv_ccmds.c sv_cvar.c sv_ents.c \
sv_user.c world.c $(syssv_SRC)
qf_server_LIBS= \
$(SERVER_PLUGIN_STATIC_LIBS) \
$(top_builddir)/libs/models/libQFmodels.la \
$(top_builddir)/libs/gamecode/engine/libQFgamecode.la \
$(top_builddir)/libs/gamecode/builtins/libQFgamecode_builtins.la \

View file

@ -80,6 +80,11 @@ static const char rcsid[] =
#include "server.h"
#include "sv_progs.h"
SERVER_PLUGIN_PROTOS
static plugin_list_t server_plugin_list[] = {
SERVER_PLUGIN_LIST
};
client_t *host_client; // current client
client_static_t cls; //FIXME needed by netchan :/
@ -2413,6 +2418,7 @@ SV_Init (void)
sv_console_plugin = Cvar_Get ("sv_console_plugin", "server",
CVAR_ROM, 0, "Plugin used for the console");
PI_RegisterPlugins (server_plugin_list);
Con_Init (sv_console_plugin->string);
Sys_SetPrintf (SV_Print);