Replace qfs_file_from_pak with qfs_foundfile.

This exposes the found name, vpath and in_pak status.
This commit is contained in:
Bill Currie 2013-11-24 15:18:42 +09:00
parent e5148493db
commit 576c73cf7c
3 changed files with 10 additions and 10 deletions

View file

@ -88,20 +88,20 @@ extern gamedir_t *qfs_gamedir;
typedef void gamedir_callback_t (int phase);
/** Base of the QFS user directory tree. The QFS functions, except for
QFS_FOpenFIle() and _QFS_FOpenFile(), will never access a file outside of
QFS_FOpenFile() and _QFS_FOpenFile(), will never access a file outside of
this tree. Set via the \c fs_userpath directory.
*/
extern const char *qfs_userpath;
/** Indicates the found file came from a pak file.
/** Gives information about the last file opened by the FOpenFile functions.
Set by QFS_FOpenFIle() and _QFS_FOpenFile().
Set by QFS_FOpenFile() and _QFS_FOpenFile().
*/
extern int qfs_file_from_pak;
extern findfile_t qfs_foundfile;
/** The size of the file found via QFS_FOpenFIle() or _QFS_FOpenFile().
/** The size of the file found via QFS_FOpenFile() or _QFS_FOpenFile().
Set by QFS_FOpenFIle() and _QFS_FOpenFile().
Set by QFS_FOpenFile() and _QFS_FOpenFile().
*/
extern int qfs_filesize;
@ -149,7 +149,7 @@ void QFS_Gamedir (const char *gamedir);
\warning The returned pointer is to a static instance of findfile_t and
thus will be overwritten on the next call to any of the search
functions (QFS_FindFile, QFS_FOpenFIle, _QFS_FOpenFile)
functions (QFS_FindFile, QFS_FOpenFile, _QFS_FOpenFile)
\param fname The name of the file to be searched for.
\param start The first vpath (gamedir) to search.

View file

@ -1010,7 +1010,7 @@ QFS_CompressPath (const char *pth)
return path;
}
VISIBLE int qfs_file_from_pak;
VISIBLE findfile_t qfs_foundfile;
/*
QFS_FOpenFile
@ -1023,7 +1023,7 @@ static void
open_file (int_findfile_t *found, QFile **gzfile, dstring_t *foundname,
int zip)
{
qfs_file_from_pak = found->ff.in_pak;
qfs_foundfile = found->ff;
if (foundname) {
dstring_copystr (foundname, found->ff.realname);
}

View file

@ -764,7 +764,7 @@ SV_BeginDownload_f (void *unused)
if (!host_client->download
// ZOID: special check for maps, if it came from a pak file, don't
// allow download
|| (strncmp (name, "maps/", 5) == 0 && qfs_file_from_pak)) {
|| (strncmp (name, "maps/", 5) == 0 && qfs_foundfile.in_pak)) {
if (host_client->download) {
Qclose (host_client->download);
host_client->download = NULL;