From 08ac9ba2f1502053d4815b0e4e6ecabc3ad6b63d Mon Sep 17 00:00:00 2001 From: molivier Date: Mon, 5 Apr 2004 06:51:41 +0000 Subject: [PATCH] Fixed the "-path" option. A couple of FS variables were never initialized explicitly git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4084 d7cf8633-e32d-0410-b094-e92efae38249 --- common.c | 2 +- fs.c | 58 ++++++++++++++++++++++++++++++-------------------------- todo | 2 +- 3 files changed, 33 insertions(+), 29 deletions(-) diff --git a/common.c b/common.c index 4ba50c90..06d51a41 100644 --- a/common.c +++ b/common.c @@ -43,7 +43,7 @@ char com_cmdline[CMDLINE_LENGTH]; int gamemode; char *gamename; char *gamedirname; -char com_modname[MAX_OSPATH]; +char com_modname[MAX_OSPATH] = ""; /* diff --git a/fs.c b/fs.c index e180f13d..a3a633a7 100644 --- a/fs.c +++ b/fs.c @@ -262,7 +262,7 @@ int fs_filesize; pack_t *packlist = NULL; -searchpath_t *fs_searchpaths; +searchpath_t *fs_searchpaths = NULL; #define MAX_FILES_IN_PACK 65536 @@ -868,7 +868,7 @@ char *FS_FileExtension (const char *in) separator = backslash; if (separator < colon) separator = colon; - if (dot < separator) + if (dot == NULL || dot < separator) return ""; dot++; for (i = 0;i < 7 && dot[i];i++) @@ -896,37 +896,19 @@ void FS_Init (void) Cmd_AddCommand ("ls", FS_Ls_f); strcpy(fs_basedir, "."); + strcpy(fs_gamedir, "."); PK3_OpenLibrary (); // -basedir // Overrides the system supplied base directory (under GAMENAME) i = COM_CheckParm ("-basedir"); - if (i && i < com_argc-1) - strlcpy (fs_basedir, com_argv[i+1], sizeof (fs_basedir)); - - i = strlen (fs_basedir); - if (i > 0 && (fs_basedir[i-1] == '\\' || fs_basedir[i-1] == '/')) - fs_basedir[i-1] = 0; - - // start up with GAMENAME by default (id1) - strlcpy (com_modname, GAMENAME, sizeof (com_modname)); - FS_AddGameDirectory (va("%s/"GAMENAME, fs_basedir)); - if (gamedirname[0]) - { - fs_modified = true; - strlcpy (com_modname, gamedirname, sizeof (com_modname)); - FS_AddGameDirectory (va("%s/%s", fs_basedir, gamedirname)); - } - - // -game - // Adds basedir/gamedir as an override game - i = COM_CheckParm ("-game"); if (i && i < com_argc-1) { - fs_modified = true; - strlcpy (com_modname, com_argv[i+1], sizeof (com_modname)); - FS_AddGameDirectory (va("%s/%s", fs_basedir, com_argv[i+1])); + strlcpy (fs_basedir, com_argv[i+1], sizeof (fs_basedir)); + i = strlen (fs_basedir); + if (i > 0 && (fs_basedir[i-1] == '\\' || fs_basedir[i-1] == '/')) + fs_basedir[i-1] = 0; } // -path [] ... @@ -935,7 +917,6 @@ void FS_Init (void) if (i) { fs_modified = true; - fs_searchpaths = NULL; while (++i < com_argc) { if (!com_argv[i] || com_argv[i][0] == '+' || com_argv[i][0] == '-') @@ -959,6 +940,29 @@ void FS_Init (void) search->next = fs_searchpaths; fs_searchpaths = search; } + return; + } + + // start up with GAMENAME by default (id1) + strlcpy (com_modname, GAMENAME, sizeof (com_modname)); + FS_AddGameDirectory (va("%s/"GAMENAME, fs_basedir)); + + // add the game-specific path, if any + if (gamedirname[0]) + { + fs_modified = true; + strlcpy (com_modname, gamedirname, sizeof (com_modname)); + FS_AddGameDirectory (va("%s/%s", fs_basedir, gamedirname)); + } + + // -game + // Adds basedir/gamedir as an override game + i = COM_CheckParm ("-game"); + if (i && i < com_argc-1) + { + fs_modified = true; + strlcpy (com_modname, com_argv[i+1], sizeof (com_modname)); + FS_AddGameDirectory (va("%s/%s", fs_basedir, com_argv[i+1])); } } @@ -2025,7 +2029,7 @@ int FS_ListDirectory(const char *pattern, int oneperline) const char *name; char linebuf[4096]; fssearch_t *search; - search = FS_Search(pattern, true, false); + search = FS_Search(pattern, true, true); if (!search) return 0; numfiles = search->numfilenames; diff --git a/todo b/todo index e24b45e4..db680de0 100644 --- a/todo +++ b/todo @@ -131,7 +131,7 @@ d darkplaces: shadow volume rendering should not unlock the arrays between rende 0 darkplaces: clean up Collision_TraceBrushBrush to have another temp variable besides f and clean up the enterfrac2 handling (Vic) 0 darkplaces: client colors are being reset to "15 15" each level in prydon gate? (FrikaC) 0 darkplaces: corona on your own muzzleflash is annoying when looking down because it can be seen (flum) -0 darkplaces: darkplaces-glx -path transfusion crashes, fix the crash even though it's not going to work anyway (Todd) +-n darkplaces: darkplaces-glx -path transfusion crashes, fix the crash even though it's not going to work anyway (Todd) 0 darkplaces: delay "connect" and "playdemo" and "timedemo" until after video init to cause quicker video startup (KrimZon) 0 darkplaces: document the TEI stuff used in Nexuiz? check telejano site first (SeienAbunae) 0 darkplaces: don't complain if lightning bolt models are missing in client (Electro, Sajt) -- 2.39.2