mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-19 07:51:43 +00:00
Merge branch 'master' into automap_fix
This commit is contained in:
commit
d70dbada1c
4 changed files with 31 additions and 10 deletions
|
@ -32,6 +32,7 @@
|
||||||
#include "hu_stuff.h"
|
#include "hu_stuff.h"
|
||||||
#include "p_setup.h"
|
#include "p_setup.h"
|
||||||
#include "lua_script.h"
|
#include "lua_script.h"
|
||||||
|
#include "d_netfil.h" // findfile
|
||||||
|
|
||||||
//========
|
//========
|
||||||
// protos.
|
// protos.
|
||||||
|
@ -641,6 +642,7 @@ static void COM_CEchoDuration_f(void)
|
||||||
static void COM_Exec_f(void)
|
static void COM_Exec_f(void)
|
||||||
{
|
{
|
||||||
UINT8 *buf = NULL;
|
UINT8 *buf = NULL;
|
||||||
|
char filename[256];
|
||||||
|
|
||||||
if (COM_Argc() < 2 || COM_Argc() > 3)
|
if (COM_Argc() < 2 || COM_Argc() > 3)
|
||||||
{
|
{
|
||||||
|
@ -649,14 +651,24 @@ static void COM_Exec_f(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// load file
|
// load file
|
||||||
|
// Try with Argv passed verbatim first, for back compat
|
||||||
FIL_ReadFile(COM_Argv(1), &buf);
|
FIL_ReadFile(COM_Argv(1), &buf);
|
||||||
|
|
||||||
|
if (!buf)
|
||||||
|
{
|
||||||
|
// Now try by searching the file path
|
||||||
|
// filename is modified with the full found path
|
||||||
|
strcpy(filename, COM_Argv(1));
|
||||||
|
if (findfile(filename, NULL, true) != FS_NOTFOUND)
|
||||||
|
FIL_ReadFile(filename, &buf);
|
||||||
|
|
||||||
if (!buf)
|
if (!buf)
|
||||||
{
|
{
|
||||||
if (!COM_CheckParm("-noerror"))
|
if (!COM_CheckParm("-noerror"))
|
||||||
CONS_Printf(M_GetText("couldn't execute file %s\n"), COM_Argv(1));
|
CONS_Printf(M_GetText("couldn't execute file %s\n"), COM_Argv(1));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!COM_CheckParm("-silent"))
|
if (!COM_CheckParm("-silent"))
|
||||||
CONS_Printf(M_GetText("executing %s\n"), COM_Argv(1));
|
CONS_Printf(M_GetText("executing %s\n"), COM_Argv(1));
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "d_clisrv.h"
|
#include "d_clisrv.h"
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
#include "i_tcp.h"
|
#include "i_tcp.h"
|
||||||
|
#include "d_main.h" // srb2home
|
||||||
|
|
||||||
//
|
//
|
||||||
// NETWORKING
|
// NETWORKING
|
||||||
|
@ -1374,12 +1375,12 @@ boolean D_CheckNetGame(void)
|
||||||
{
|
{
|
||||||
k++;
|
k++;
|
||||||
sprintf(filename, "debug%d.txt", k);
|
sprintf(filename, "debug%d.txt", k);
|
||||||
debugfile = fopen(filename, "w");
|
debugfile = fopen(va("%s" PATHSEP "%s", srb2home, filename), "w");
|
||||||
}
|
}
|
||||||
if (debugfile)
|
if (debugfile)
|
||||||
CONS_Printf(M_GetText("debug output to: %s\n"), filename);
|
CONS_Printf(M_GetText("debug output to: %s\n"), va("%s" PATHSEP "%s", srb2home, filename));
|
||||||
else
|
else
|
||||||
CONS_Alert(CONS_WARNING, M_GetText("cannot debug output to file %s!\n"), filename);
|
CONS_Alert(CONS_WARNING, M_GetText("cannot debug output to file %s!\n"), va("%s" PATHSEP "%s", srb2home, filename));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3080,7 +3080,7 @@ static void readmaincfg(MYFILE *f)
|
||||||
strncpy(timeattackfolder, gamedatafilename, min(filenamelen, sizeof (timeattackfolder)));
|
strncpy(timeattackfolder, gamedatafilename, min(filenamelen, sizeof (timeattackfolder)));
|
||||||
timeattackfolder[min(filenamelen, sizeof (timeattackfolder) - 1)] = '\0';
|
timeattackfolder[min(filenamelen, sizeof (timeattackfolder) - 1)] = '\0';
|
||||||
|
|
||||||
strncpy(savegamename, timeattackfolder, strlen(timeattackfolder));
|
strcpy(savegamename, timeattackfolder);
|
||||||
strlcat(savegamename, "%u.ssg", sizeof(savegamename));
|
strlcat(savegamename, "%u.ssg", sizeof(savegamename));
|
||||||
// can't use sprintf since there is %u in savegamename
|
// can't use sprintf since there is %u in savegamename
|
||||||
strcatbf(savegamename, srb2home, PATHSEP);
|
strcatbf(savegamename, srb2home, PATHSEP);
|
||||||
|
|
14
src/m_misc.c
14
src/m_misc.c
|
@ -518,6 +518,7 @@ void M_FirstLoadConfig(void)
|
||||||
void M_SaveConfig(const char *filename)
|
void M_SaveConfig(const char *filename)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
char *filepath;
|
||||||
|
|
||||||
// make sure not to write back the config until it's been correctly loaded
|
// make sure not to write back the config until it's been correctly loaded
|
||||||
if (!gameconfig_loaded)
|
if (!gameconfig_loaded)
|
||||||
|
@ -532,13 +533,20 @@ void M_SaveConfig(const char *filename)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
f = fopen(filename, "w");
|
// append srb2home to beginning of filename
|
||||||
|
// but check if srb2home isn't already there, first
|
||||||
|
if (!strstr(filename, srb2home))
|
||||||
|
filepath = va(pandf,srb2home, filename);
|
||||||
|
else
|
||||||
|
filepath = Z_StrDup(filename);
|
||||||
|
|
||||||
|
f = fopen(filepath, "w");
|
||||||
// change it only if valid
|
// change it only if valid
|
||||||
if (f)
|
if (f)
|
||||||
strcpy(configfile, filename);
|
strcpy(configfile, filepath);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_ERROR, M_GetText("Couldn't save game config file %s\n"), filename);
|
CONS_Alert(CONS_ERROR, M_GetText("Couldn't save game config file %s\n"), filepath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue