diff --git a/common/host.c b/common/host.c index 366e5dd..29a1d27 100644 --- a/common/host.c +++ b/common/host.c @@ -565,6 +565,8 @@ Host_Init (quakeparms_t *parms) CL_InitCvars (); SCR_InitCvars (); VID_InitCvars (); + COM_Init (); + Cmd_Exec_File (global_cfg_file->string); Cbuf_Execute (); @@ -578,14 +580,10 @@ Host_Init (quakeparms_t *parms) Chase_Init (); #ifdef QUAKEWORLD - COM_Init (); - NET_Init (PORT_CLIENT); Netchan_Init (); #elif UQUAKE Host_InitVCR (parms); - - COM_Init (); Host_InitLocal (); #endif diff --git a/common/quakefs.c b/common/quakefs.c index 9617bcf..8bdf3d7 100644 --- a/common/quakefs.c +++ b/common/quakefs.c @@ -44,6 +44,11 @@ #include #include #include +#include +#if defined(QUAKEWORLD) && defined(SERVERONLY) +#include +#include +#endif #include #include @@ -937,6 +942,45 @@ COM_Gamedir (char *dir) COM_AddGameDirectory (dir); } +/* +================ +SV_Gamedir_f + +Sets the gamedir and path to a different directory. +================ +*/ +char gamedirfile[MAX_OSPATH]; +void COM_Gamedir_f (void) +{ + char *dir; + + if (Cmd_Argc() == 1) + { + Con_Printf ("Current gamedir: %s\n", com_gamedir); + return; + } + + if (Cmd_Argc() != 2) + { + Con_Printf ("Usage: gamedir \n"); + return; + } + + dir = Cmd_Argv(1); + + if (strstr(dir, "..") || strstr(dir, "/") + || strstr(dir, "\\") || strstr(dir, ":") ) + { + Con_Printf ("Gamedir should be a single filename, not a path\n"); + return; + } + + COM_Gamedir (dir); +#if defined(QUAKEWORLD) && defined(SERVERONLY) + Info_SetValueForStarKey (svs.info, "*gamedir", dir, MAX_SERVERINFO_STRING); +#endif +} + /* COM_InitFilesystem */ @@ -951,6 +995,8 @@ COM_InitFilesystem ( void ) "the location of your game directories"); fs_sharepath = Cvar_Get ("fs_sharepath", fs_basepath->string, CVAR_ROM, "read-only game directories"); + Cmd_AddCommand ("gamedir", COM_Gamedir_f); + /* start up with GAMENAME by default */ diff --git a/common/quakefs.h b/common/quakefs.h index a69dae7..7858d2b 100644 --- a/common/quakefs.h +++ b/common/quakefs.h @@ -41,7 +41,8 @@ extern int com_filesize; struct cache_user_s; -extern char com_gamedir[MAX_OSPATH]; +extern char com_gamedir[MAX_OSPATH]; +extern char gamedirfile[MAX_OSPATH]; void COM_WriteFile (char *filename, void *data, int len); int COM_FOpenFile (char *filename, QFile **gzfile); diff --git a/qw_server/sv_ccmds.c b/qw_server/sv_ccmds.c index 36db349..c651cf6 100644 --- a/qw_server/sv_ccmds.c +++ b/qw_server/sv_ccmds.c @@ -783,43 +783,6 @@ void SV_Gamedir (void) Info_SetValueForStarKey (svs.info, "*gamedir", dir, MAX_SERVERINFO_STRING); } -/* -================ -SV_Gamedir_f - -Sets the gamedir and path to a different directory. -================ -*/ -char gamedirfile[MAX_OSPATH]; -void SV_Gamedir_f (void) -{ - char *dir; - - if (Cmd_Argc() == 1) - { - Con_Printf ("Current gamedir: %s\n", com_gamedir); - return; - } - - if (Cmd_Argc() != 2) - { - Con_Printf ("Usage: gamedir \n"); - return; - } - - dir = Cmd_Argv(1); - - if (strstr(dir, "..") || strstr(dir, "/") - || strstr(dir, "\\") || strstr(dir, ":") ) - { - Con_Printf ("Gamedir should be a single filename, not a path\n"); - return; - } - - COM_Gamedir (dir); - Info_SetValueForStarKey (svs.info, "*gamedir", dir, MAX_SERVERINFO_STRING); -} - /* ================ SV_Snap @@ -968,7 +931,6 @@ void SV_InitOperatorCommands (void) Cmd_AddCommand ("serverinfo", SV_Serverinfo_f); Cmd_AddCommand ("localinfo", SV_Localinfo_f); Cmd_AddCommand ("user", SV_User_f); - Cmd_AddCommand ("gamedir", SV_Gamedir_f); Cmd_AddCommand ("sv_gamedir", SV_Gamedir); Cmd_AddCommand ("floodprot", SV_Floodprot_f); Cmd_AddCommand ("floodprotmsg", SV_Floodprotmsg_f); diff --git a/uquake/host_cmd.c b/uquake/host_cmd.c index 02d6a38..c55ed93 100644 --- a/uquake/host_cmd.c +++ b/uquake/host_cmd.c @@ -192,43 +192,6 @@ void Host_Noclip_f (void) } } -/* -================ -Host_Gamedir_f - -Sets the gamedir and path to a different directory. -================ -*/ -char gamedirfile[MAX_OSPATH]; -void -Host_Gamedir_f (void) -{ - char *dir; - - if (Cmd_Argc() == 1) - { - Con_Printf ("Current gamedir: %s\n", com_gamedir); - return; - } - - if (Cmd_Argc() != 2) - { - Con_Printf ("Usage: gamedir \n"); - return; - } - - dir = Cmd_Argv(1); - - if (strstr(dir, "..") || strstr(dir, "/") - || strstr(dir, "\\") || strstr(dir, ":") ) - { - Con_Printf ("Gamedir should be a single filename, not a path\n"); - return; - } - - COM_Gamedir (dir); -} - /* ================== Host_Fly_f @@ -1953,5 +1916,4 @@ void Host_InitCommands (void) Cmd_AddCommand ("viewprev", Host_Viewprev_f); Cmd_AddCommand ("mcache", Mod_Print); - Cmd_AddCommand ("gamedir", Host_Gamedir_f); }