]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Revert "fs: save files in the correct place when gamedir(s) are in use"
authorbones_was_here <bones_was_here@xonotic.au>
Mon, 1 Apr 2024 11:37:16 +0000 (21:37 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Mon, 1 Apr 2024 11:37:16 +0000 (21:37 +1000)
This reverts commit 5db369bea3d0cdd3dbd3b5b8038a399f0dbf84b6.

Closes https://github.com/DarkPlacesEngine/darkplaces/issues/150

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
fs.c
fs.h

diff --git a/fs.c b/fs.c
index bea6cbcd586ed9432ab0ebec6a8201a37254b4c5..445df3684b959947afb583820d95595803d45ffb 100644 (file)
--- a/fs.c
+++ b/fs.c
@@ -1345,14 +1345,13 @@ Sets fs_gamedir, adds the directory to the head of the path,
 then loads and adds pak1.pak pak2.pak ...
 ================
 */
-static void FS_AddGameDirectory (const char *dir, qbool set_fs_gamedir)
+static void FS_AddGameDirectory (const char *dir)
 {
        int i;
        stringlist_t list;
        searchpath_t *search;
 
-       if (set_fs_gamedir)
-               dp_strlcpy (fs_gamedir, dir, sizeof (fs_gamedir));
+       dp_strlcpy (fs_gamedir, dir, sizeof (fs_gamedir));
 
        stringlistinit(&list);
        listdirectory(&list, "", dir);
@@ -1393,14 +1392,14 @@ static void FS_AddGameDirectory (const char *dir, qbool set_fs_gamedir)
 FS_AddGameHierarchy
 ================
 */
-static void FS_AddGameHierarchy (const char *dir, qbool set_fs_gamedir)
+static void FS_AddGameHierarchy (const char *dir)
 {
        char vabuf[1024];
        // Add the common game directory
-       FS_AddGameDirectory (va(vabuf, sizeof(vabuf), "%s%s/", fs_basedir, dir), set_fs_gamedir);
+       FS_AddGameDirectory (va(vabuf, sizeof(vabuf), "%s%s/", fs_basedir, dir));
 
        if (*fs_userdir)
-               FS_AddGameDirectory(va(vabuf, sizeof(vabuf), "%s%s/", fs_userdir, dir), set_fs_gamedir);
+               FS_AddGameDirectory(va(vabuf, sizeof(vabuf), "%s%s/", fs_userdir, dir));
 }
 
 
@@ -1561,32 +1560,30 @@ void FS_Rescan (void)
 
        // add the game-specific paths
        // gamedirname1 (typically id1)
-       FS_AddGameHierarchy (gamedirname1, true);
+       FS_AddGameHierarchy (gamedirname1);
        // update the com_modname (used for server info)
        if (gamedirname2 && gamedirname2[0])
                dp_strlcpy(com_modname, gamedirname2, sizeof(com_modname));
        else
                dp_strlcpy(com_modname, gamedirname1, sizeof(com_modname));
 
-       // add the secondary game-specific path, if any
+       // add the game-specific path, if any
        // (only used for mission packs and the like, which should set fs_modified)
        if (gamedirname2 && gamedirname2[0])
        {
                fs_modified = true;
-               FS_AddGameHierarchy (gamedirname2, true);
+               FS_AddGameHierarchy (gamedirname2);
        }
 
        // -game <gamedir>
        // Adds basedir/gamedir as an override game
        // LadyHavoc: now supports multiple -game directories
        // set the com_modname (reported in server info)
-       // bones_was_here: does NOT set fs_gamedir in FS_AddGameHierarchy()
-       // so that we still save files in the right place.
        *gamedirbuf = 0;
        for (i = 0;i < fs_numgamedirs;i++)
        {
                fs_modified = true;
-               FS_AddGameHierarchy (fs_gamedirs[i], false);
+               FS_AddGameHierarchy (fs_gamedirs[i]);
                // update the com_modname (used server info)
                dp_strlcpy (com_modname, fs_gamedirs[i], sizeof (com_modname));
                if(i)
diff --git a/fs.h b/fs.h
index 60658027810a4cbbaf1af5062c6607d7af39a8b6..d839833172cbadd9d58ea3e17abee5b458f0477c 100644 (file)
--- a/fs.h
+++ b/fs.h
@@ -38,7 +38,7 @@ typedef int64_t fs_offset_t;
 
 // ------ Variables ------ //
 
-extern char fs_gamedir [MAX_OSPATH]; ///< Files will be saved in this gamedir.
+extern char fs_gamedir [MAX_OSPATH];
 extern char fs_basedir [MAX_OSPATH];
 extern char fs_userdir [MAX_OSPATH];