X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=fs.c;h=7a80304defc4f17b6d1bc1c599016e779ae308b2;hp=58a0c33463ffb0fa371858497698ac80037b8443;hb=ce1f098cd683f58c4d99bb1f53182f6f66c3f30c;hpb=0638b271010848e6e75e2f04aa8c2b8207775e59 diff --git a/fs.c b/fs.c index 58a0c334..7a80304d 100644 --- a/fs.c +++ b/fs.c @@ -237,6 +237,7 @@ typedef struct packfile_s typedef struct pack_s { char filename [MAX_OSPATH]; + char shortname [MAX_QPATH]; int handle; int ignorecase; // PK3 ignores case int numfiles; @@ -879,7 +880,7 @@ If keep_plain_dirs is set, the pack will be added AFTER the first sequence of plain directories. ================ */ -static qboolean FS_AddPack_Fullpath(const char *pakfile, qboolean *already_loaded, qboolean keep_plain_dirs) +static qboolean FS_AddPack_Fullpath(const char *pakfile, const char *shortname, qboolean *already_loaded, qboolean keep_plain_dirs) { searchpath_t *search; pack_t *pak = NULL; @@ -907,6 +908,8 @@ static qboolean FS_AddPack_Fullpath(const char *pakfile, qboolean *already_loade if (pak) { + strlcpy(pak->shortname, shortname, sizeof(pak->shortname)); + //Con_DPrintf(" Registered pack with short name %s\n", shortname); if(keep_plain_dirs) { // find the first item whose next one is a pack or NULL @@ -992,7 +995,7 @@ qboolean FS_AddPack(const char *pakfile, qboolean *already_loaded, qboolean keep dpsnprintf(fullpath, sizeof(fullpath), "%s%s", search->filename, pakfile); - return FS_AddPack_Fullpath(fullpath, already_loaded, keep_plain_dirs); + return FS_AddPack_Fullpath(fullpath, pakfile, already_loaded, keep_plain_dirs); } @@ -1021,7 +1024,7 @@ void FS_AddGameDirectory (const char *dir) { if (!strcasecmp(FS_FileExtension(list.strings[i]), "pak")) { - FS_AddPack_Fullpath(list.strings[i], NULL, false); + FS_AddPack_Fullpath(list.strings[i], list.strings[i] + strlen(dir), NULL, false); } } @@ -1030,7 +1033,7 @@ void FS_AddGameDirectory (const char *dir) { if (!strcasecmp(FS_FileExtension(list.strings[i]), "pk3")) { - FS_AddPack_Fullpath(list.strings[i], NULL, false); + FS_AddPack_Fullpath(list.strings[i], list.strings[i] + strlen(dir), NULL, false); } } @@ -2991,7 +2994,7 @@ const char *FS_WhichPack(const char *filename) int index; searchpath_t *sp = FS_FindFile(filename, &index, true); if(sp && sp->pack) - return sp->pack->filename; + return sp->pack->shortname; else return 0; }