From 2a12c9df2ff36a5ad7f6e5c84438ac5571f6ba8c Mon Sep 17 00:00:00 2001 From: rubidium Date: Wed, 24 Aug 2011 13:42:06 +0000 Subject: [PATCH] (svn r22825) -Codechange: pass subdir to FioOpenFile --- src/fileio.cpp | 7 ++++--- src/fileio_func.h | 2 +- src/gfxinit.cpp | 4 ++-- src/newgrf.cpp | 2 +- src/sound.cpp | 2 +- src/spriteloader/png.cpp | 2 +- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/fileio.cpp b/src/fileio.cpp index 4bc4758571..d2b3c7fc23 100644 --- a/src/fileio.cpp +++ b/src/fileio.cpp @@ -237,15 +237,16 @@ static void FioFreeHandle() * Open a slotted file. * @param slot Index to assign. * @param filename Name of the file at the disk. - */ -void FioOpenFile(int slot, const char *filename) + * @param subdir The sub directory to search this file in. + */ +void FioOpenFile(int slot, const char *filename, Subdirectory subdir) { FILE *f; #if defined(LIMITED_FDS) FioFreeHandle(); #endif /* LIMITED_FDS */ - f = FioFOpenFile(filename); + f = FioFOpenFile(filename, "rb", subdir); if (f == NULL) usererror("Cannot open file '%s'", filename); uint32 pos = ftell(f); diff --git a/src/fileio_func.h b/src/fileio_func.h index 7f39f09e89..475b89814f 100644 --- a/src/fileio_func.h +++ b/src/fileio_func.h @@ -22,7 +22,7 @@ byte FioReadByte(); uint16 FioReadWord(); uint32 FioReadDword(); void FioCloseAll(); -void FioOpenFile(int slot, const char *filename); +void FioOpenFile(int slot, const char *filename, Subdirectory subdir); void FioReadBlock(void *ptr, size_t size); void FioSkipBytes(int n); diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp index 98d0ad390e..eeaac8d9f8 100644 --- a/src/gfxinit.cpp +++ b/src/gfxinit.cpp @@ -38,7 +38,7 @@ static uint LoadGrfFile(const char *filename, uint load_index, int file_index) uint load_index_org = load_index; uint sprite_id = 0; - FioOpenFile(file_index, filename); + FioOpenFile(file_index, filename, NEWGRF_DIR); DEBUG(sprite, 2, "Reading grf-file '%s'", filename); @@ -73,7 +73,7 @@ static void LoadGrfIndexed(const char *filename, const SpriteID *index_tbl, int { uint sprite_id = 0; - FioOpenFile(file_index, filename); + FioOpenFile(file_index, filename, NEWGRF_DIR); DEBUG(sprite, 2, "Reading indexed grf-file '%s'", filename); diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 94d57e7c53..d4594356ac 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -8105,7 +8105,7 @@ void LoadNewGRFFile(GRFConfig *config, uint file_index, GrfLoadingStage stage) return; } - FioOpenFile(file_index, filename); + FioOpenFile(file_index, filename, NEWGRF_DIR); _cur.file_index = file_index; // XXX _palette_remap_grf[_cur.file_index] = (config->palette & GRFP_USE_MASK); diff --git a/src/sound.cpp b/src/sound.cpp index 4b6886d361..2834078829 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -30,7 +30,7 @@ static void OpenBankFile(const char *filename) /* If there is no sound file (nosound set), don't load anything */ if (filename == NULL) return; - FioOpenFile(SOUND_SLOT, filename); + FioOpenFile(SOUND_SLOT, filename, BASESET_DIR); size_t pos = FioGetPos(); uint count = FioReadDword(); diff --git a/src/spriteloader/png.cpp b/src/spriteloader/png.cpp index fa66ae3f1a..a1a6aa4a1d 100644 --- a/src/spriteloader/png.cpp +++ b/src/spriteloader/png.cpp @@ -43,7 +43,7 @@ static bool OpenPNGFile(const char *filename, uint32 id, bool mask) const char *sep = (filename[0] == PATHSEPCHAR) ? "" : PATHSEP; snprintf(png_file, sizeof(png_file), "sprites%s%s" PATHSEP "%d%s.png", sep, filename, id, mask ? "m" : ""); if (FioCheckFileExists(png_file)) { - FioOpenFile(PNG_SLOT, png_file); + FioOpenFile(PNG_SLOT, png_file, NEWGRF_DIR); return true; }