Create _QFS_VOpenFile and QFS_VOpenFile.

_QFS_VOpenFile is actually _QFS_FOpenFile reimplemented to take vpath start
and end parameters so the search can be limited. QFS_VOpenFile,
_QFS_FOpenFile, and QFS_FOpenFile are all wrappers for _QFS_VOpenFile.
This commit is contained in:
Bill Currie 2014-01-23 13:08:44 +09:00
parent 3efb0c538f
commit 8bea6a66ca
2 changed files with 21 additions and 3 deletions

View file

@ -202,6 +202,11 @@ QFile *QFS_WOpen (const char *path, int zip);
*/
void QFS_WriteFile (const char *filename, const void *data, int len);
QFile *_QFS_VOpenFile (const char *filename, int zip,
const vpath_t *start, const vpath_t *end);
QFile *QFS_VOpenFile (const char *filename,
const vpath_t *start, const vpath_t *end);
/** Open a file for reading.
The file will be searched for through all the subdirectories given in the

View file

@ -1033,7 +1033,8 @@ open_file (int_findfile_t *found, QFile **gzfile, int zip)
}
VISIBLE QFile *
_QFS_FOpenFile (const char *filename, int zip)
_QFS_VOpenFile (const char *filename, int zip,
const vpath_t *start, const vpath_t *end)
{
QFile *gzfile;
int_findfile_t *found;
@ -1081,7 +1082,7 @@ _QFS_FOpenFile (const char *filename, int zip)
fnames[ind] = 0;
found = qfs_findfile (fnames, 0, 0);
found = qfs_findfile (fnames, start, end);
if (found) {
open_file (found, &gzfile, zip_flags[found->fname_index]);
@ -1096,10 +1097,22 @@ error:
return 0;
}
VISIBLE QFile *
QFS_VOpenFile (const char *filename, const vpath_t *start, const vpath_t *end)
{
return _QFS_VOpenFile (filename, 1, start, end);
}
VISIBLE QFile *
_QFS_FOpenFile (const char *filename, int zip)
{
return _QFS_VOpenFile (filename, zip, 0, 0);
}
VISIBLE QFile *
QFS_FOpenFile (const char *filename)
{
return _QFS_FOpenFile (filename, 1);
return _QFS_VOpenFile (filename, 1, 0, 0);
}
static cache_user_t *loadcache;