use a private cbuf for map_cfg

This commit is contained in:
Bill Currie 2003-08-12 23:22:30 +00:00
parent c9346e806c
commit 70ec073904

View file

@ -51,6 +51,7 @@ static __attribute__ ((unused)) const char rcsid[] =
#include "QF/cvar.h" #include "QF/cvar.h"
#include "QF/draw.h" #include "QF/draw.h"
#include "QF/hash.h" #include "QF/hash.h"
#include "QF/idparse.h"
#include "QF/msg.h" #include "QF/msg.h"
#include "QF/quakeio.h" #include "QF/quakeio.h"
#include "QF/screen.h" #include "QF/screen.h"
@ -258,21 +259,23 @@ map_cfg (const char *mapname, int all)
{ {
char *name = malloc (strlen (mapname) + 4 + 1); char *name = malloc (strlen (mapname) + 4 + 1);
QFile *f; QFile *f;
cbuf_t *cbuf = Cbuf_New (&id_interp);
QFS_StripExtension (mapname, name); QFS_StripExtension (mapname, name);
strcat (name, ".cfg"); strcat (name, ".cfg");
QFS_FOpenFile (name, &f); QFS_FOpenFile (name, &f);
if (f) { if (f) {
Qclose (f); Qclose (f);
Cmd_Exec_File (cl_cbuf, name, 1); Cmd_Exec_File (cbuf, name, 1);
} else { } else {
Cmd_Exec_File (cl_cbuf, "maps_default.cfg", 1); Cmd_Exec_File (cbuf, "maps_default.cfg", 1);
} }
if (all) if (all)
Cbuf_Execute_Stack (cl_cbuf); Cbuf_Execute_Stack (cbuf);
else else
Cbuf_Execute_Sets (cl_cbuf); Cbuf_Execute_Sets (cbuf);
free (name); free (name);
Cbuf_Delete(cbuf);
} }
static void static void