mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +00:00
change Cmd_Exec_File's api so it can conditionally use normal or quake
file system accesses. fixes the map.cfg exec problem
This commit is contained in:
parent
d46b37f940
commit
3d44623b57
7 changed files with 22 additions and 17 deletions
|
@ -61,7 +61,7 @@ void Cmd_Command (struct cbuf_args_s *args);
|
|||
int Cmd_ExecuteString (const char *text, cmd_source_t src);
|
||||
struct cbuf_s;
|
||||
void Cmd_StuffCmds (struct cbuf_s *cbuf);
|
||||
void Cmd_Exec_File (struct cbuf_s *cbuf, const char *path);
|
||||
void Cmd_Exec_File (struct cbuf_s *cbuf, const char *path, int qfs);
|
||||
void Cmd_Return (const char *value);
|
||||
void Cmd_Error (const char *message);
|
||||
|
||||
|
|
|
@ -625,7 +625,7 @@ Cmd_ExecuteString (const char *text, cmd_source_t src)
|
|||
}
|
||||
|
||||
void
|
||||
Cmd_Exec_File (cbuf_t *cbuf, const char *path)
|
||||
Cmd_Exec_File (cbuf_t *cbuf, const char *path, int qfs)
|
||||
{
|
||||
char *f;
|
||||
int len;
|
||||
|
@ -633,17 +633,22 @@ Cmd_Exec_File (cbuf_t *cbuf, const char *path)
|
|||
|
||||
if (!path || !*path)
|
||||
return;
|
||||
if ((file = Qopen (path, "r")) != NULL) {
|
||||
if (qfs) {
|
||||
COM_FOpenFile (path, &file);
|
||||
} else {
|
||||
file = Qopen (path, "r");
|
||||
}
|
||||
if (file) {
|
||||
len = Qfilesize (file);
|
||||
f = (char *) malloc (len + 1);
|
||||
if (f) {
|
||||
f[len] = 0;
|
||||
Qread (file, f, len);
|
||||
Qclose (file);
|
||||
// Always insert into console
|
||||
Cbuf_InsertText (cbuf, f);
|
||||
free (f);
|
||||
}
|
||||
Qclose (file);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -229,9 +229,9 @@ map_cfg (const char *mapname, int all)
|
|||
COM_FOpenFile (name, &f);
|
||||
if (f) {
|
||||
Qclose (f);
|
||||
Cmd_Exec_File (host_cbuf, name);
|
||||
Cmd_Exec_File (host_cbuf, name, 1);
|
||||
} else {
|
||||
Cmd_Exec_File (host_cbuf, "maps_default.cfg");
|
||||
Cmd_Exec_File (host_cbuf, "maps_default.cfg", 1);
|
||||
}
|
||||
if (all)
|
||||
Cbuf_Execute_Stack (host_cbuf);
|
||||
|
|
|
@ -877,7 +877,7 @@ Host_Init (void)
|
|||
// probably Not A Good Thing (tm).
|
||||
fs_globalcfg = Cvar_Get ("fs_globalcfg", FS_GLOBALCFG,
|
||||
CVAR_ROM, NULL, "global configuration file");
|
||||
Cmd_Exec_File (host_cbuf, fs_globalcfg->string);
|
||||
Cmd_Exec_File (host_cbuf, fs_globalcfg->string, 0);
|
||||
Cbuf_Execute_Sets (host_cbuf);
|
||||
|
||||
// execute +set again to override the config file
|
||||
|
@ -886,7 +886,7 @@ Host_Init (void)
|
|||
|
||||
fs_usercfg = Cvar_Get ("fs_usercfg", FS_USERCFG, CVAR_ROM, NULL,
|
||||
"user configuration file");
|
||||
Cmd_Exec_File (host_cbuf, fs_usercfg->string);
|
||||
Cmd_Exec_File (host_cbuf, fs_usercfg->string, 0);
|
||||
Cbuf_Execute_Sets (host_cbuf);
|
||||
|
||||
// execute +set again to override the config file
|
||||
|
@ -979,7 +979,7 @@ Host_Init (void)
|
|||
|
||||
if (!isDedicated && cl_quakerc->int_val)
|
||||
Cbuf_InsertText (host_cbuf, "exec quake.rc\n");
|
||||
Cmd_Exec_File (host_cbuf, fs_usercfg->string);
|
||||
Cmd_Exec_File (host_cbuf, fs_usercfg->string, 0);
|
||||
// reparse the command line for + commands other than set
|
||||
// (sets still done, but it doesn't matter)
|
||||
if (isDedicated || (cl_quakerc->int_val && check_quakerc ()))
|
||||
|
|
|
@ -1711,7 +1711,7 @@ Host_Init (void)
|
|||
// probably Not A Good Thing (tm).
|
||||
fs_globalcfg = Cvar_Get ("fs_globalcfg", FS_GLOBALCFG, CVAR_ROM, NULL,
|
||||
"global configuration file");
|
||||
Cmd_Exec_File (cl_cbuf, fs_globalcfg->string);
|
||||
Cmd_Exec_File (cl_cbuf, fs_globalcfg->string, 0);
|
||||
Cbuf_Execute_Sets (cl_cbuf);
|
||||
|
||||
// execute +set again to override the config file
|
||||
|
@ -1720,7 +1720,7 @@ Host_Init (void)
|
|||
|
||||
fs_usercfg = Cvar_Get ("fs_usercfg", FS_USERCFG, CVAR_ROM, NULL,
|
||||
"user configuration file");
|
||||
Cmd_Exec_File (cl_cbuf, fs_usercfg->string);
|
||||
Cmd_Exec_File (cl_cbuf, fs_usercfg->string, 0);
|
||||
Cbuf_Execute_Sets (cl_cbuf);
|
||||
|
||||
// execute +set again to override the config file
|
||||
|
@ -1824,7 +1824,7 @@ Host_Init (void)
|
|||
|
||||
if (cl_quakerc->int_val)
|
||||
Cbuf_InsertText (cl_cbuf, "exec quake.rc\n");
|
||||
Cmd_Exec_File (cl_cbuf, fs_usercfg->string);
|
||||
Cmd_Exec_File (cl_cbuf, fs_usercfg->string, 0);
|
||||
// Reparse the command line for + commands.
|
||||
// (Note, no non-base commands exist yet)
|
||||
if (!cl_quakerc->int_val || check_quakerc ())
|
||||
|
|
|
@ -264,9 +264,9 @@ map_cfg (const char *mapname, int all)
|
|||
COM_FOpenFile (name, &f);
|
||||
if (f) {
|
||||
Qclose (f);
|
||||
Cmd_Exec_File (cl_cbuf, name);
|
||||
Cmd_Exec_File (cl_cbuf, name, 1);
|
||||
} else {
|
||||
Cmd_Exec_File (cl_cbuf, "maps_default.cfg");
|
||||
Cmd_Exec_File (cl_cbuf, "maps_default.cfg", 1);
|
||||
}
|
||||
if (all)
|
||||
Cbuf_Execute_Stack (cl_cbuf);
|
||||
|
|
|
@ -2480,7 +2480,7 @@ SV_Init (void)
|
|||
// probably Not A Good Thing (tm).
|
||||
fs_globalcfg = Cvar_Get ("fs_globalcfg", FS_GLOBALCFG,
|
||||
CVAR_ROM, 0, "global configuration file");
|
||||
Cmd_Exec_File (sv_cbuf, fs_globalcfg->string);
|
||||
Cmd_Exec_File (sv_cbuf, fs_globalcfg->string, 0);
|
||||
Cbuf_Execute_Sets (sv_cbuf);
|
||||
|
||||
// execute +set again to override the config file
|
||||
|
@ -2489,7 +2489,7 @@ SV_Init (void)
|
|||
|
||||
fs_usercfg = Cvar_Get ("fs_usercfg", FS_USERCFG,
|
||||
CVAR_ROM, 0, "user configuration file");
|
||||
Cmd_Exec_File (sv_cbuf, fs_usercfg->string);
|
||||
Cmd_Exec_File (sv_cbuf, fs_usercfg->string, 0);
|
||||
Cbuf_Execute_Sets (sv_cbuf);
|
||||
|
||||
// execute +set again to override the config file
|
||||
|
@ -2561,7 +2561,7 @@ SV_Init (void)
|
|||
SV_Printf ("<==> %s initialized <==>\n", PROGRAM);
|
||||
|
||||
// process command line arguments
|
||||
Cmd_Exec_File (sv_cbuf, fs_usercfg->string);
|
||||
Cmd_Exec_File (sv_cbuf, fs_usercfg->string, 0);
|
||||
Cmd_StuffCmds (sv_cbuf);
|
||||
Cbuf_Execute (sv_cbuf);
|
||||
|
||||
|
|
Loading…
Reference in a new issue