shuffle things around so gamedir works early on in the piece. Also put it into qw-client in the first place. grr Unfortunatly, doesn't fix our class change problem :(

This commit is contained in:
Bill Currie 2000-04-27 09:25:38 +00:00
parent 3c8ff479a3
commit e94c1488ac
5 changed files with 50 additions and 81 deletions

View File

@ -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

View File

@ -44,6 +44,11 @@
#include <common.h>
#include <draw.h>
#include <cvars.h>
#include <cmd.h>
#if defined(QUAKEWORLD) && defined(SERVERONLY)
#include <common_protocol.h>
#include <server.h>
#endif
#include <dirent.h>
#include <fnmatch.h>
@ -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 <newdir>\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
*/

View File

@ -42,6 +42,7 @@ extern int com_filesize;
struct cache_user_s;
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);

View File

@ -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 <newdir>\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);

View File

@ -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 <newdir>\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);
}