Mapster32: take initial map file name from ExtPreInit()->G_CheckCommandLine().

Instead of directly in build.c:app_main(). Previously, it was possible that an
argument to an option, e.g. "WGR2" with "-game_dir WGR2", would get interpreted
as the initial map to load. This in turn would attempt to execute WGR2.cfg as
sequence of OSD commands -- where that file is an EDuke32 config file instead!

Now: maps are passed without any options, e.g. "mapster32 [opts...] debug.map".
The map file name is not added to the "additional parameters" for map testing.

git-svn-id: https://svn.eduke32.com/eduke32@4121 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-10-28 21:26:25 +00:00
parent 94e3856b76
commit c2797e4b11
3 changed files with 12 additions and 5 deletions

View File

@ -177,6 +177,7 @@ extern void ExtEditWallData(int16_t wallnum);
extern void ExtEditSpriteData(int16_t spritenum);
extern const char *ExtGetSectorType(int32_t lotag);
extern void B_SetBoardFileName(const char *fn);
extern int32_t LoadBoard(const char *filename, uint32_t flags);
extern const char *SaveBoard(const char *fn, uint32_t flags);
extern const char *GetSaveBoardFilename(const char *fn);

View File

@ -131,6 +131,11 @@ char *testplay_addparam = 0;
static char boardfilename[BMAX_PATH], selectedboardfilename[BMAX_PATH];
//extern char levelname[BMAX_PATH]; // in astub.c XXX: clean up this mess!!!
void B_SetBoardFileName(const char *fn)
{
Bstrncpyz(boardfilename, fn, BMAX_PATH);
}
static fnlist_t fnlist;
static CACHE1D_FIND_REC *finddirshigh=NULL, *findfileshigh=NULL;
static int32_t currentlist=0;
@ -523,7 +528,6 @@ int32_t app_main(int32_t argc, const char **argv)
backgroundidle = 1;
#endif
boardfilename[0] = 0;
for (i=1; i<argc; i++)
{
if (argv[i][0] == '-')
@ -553,9 +557,6 @@ int32_t app_main(int32_t argc, const char **argv)
}
continue;
}
if (!boardfilename[0])
Bstrncpyz(boardfilename, argv[i], BMAX_PATH);
}
if (boardfilename[0] == 0)

View File

@ -8780,7 +8780,12 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
k = Bstrrchr(c,'.');
if (k)
{
if (!Bstrcasecmp(k,".grp") || !Bstrcasecmp(k,".zip"))
if (!Bstrcasecmp(k,".map"))
{
B_SetBoardFileName(argv[i++]);
continue;
}
else if (!Bstrcasecmp(k,".grp") || !Bstrcasecmp(k,".zip"))
{
COPYARG(i);
G_AddGroup(argv[i++]);