Mercurial > hg > openttd
changeset 18018:873018a3a54e draft
(svn r22827) -Codechange: pass the/a more proper sub directory when opening (some) files instead of the default one
author | rubidium <rubidium@openttd.org> |
---|---|
date | Wed, 24 Aug 2011 13:53:34 +0000 |
parents | 63bd30142ab5 |
children | 17be4c7991db |
files | src/fileio_func.h src/fios.cpp src/heightmap.cpp src/saveload/oldloader.cpp src/spriteloader/png.cpp |
diffstat | 5 files changed, 8 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/fileio_func.h +++ b/src/fileio_func.h @@ -48,8 +48,8 @@ #define FOR_ALL_SEARCHPATHS(sp) for (sp = SP_FIRST_DIR; sp < NUM_SEARCHPATHS; sp++) if (IsValidSearchPath(sp)) void FioFCloseFile(FILE *f); -FILE *FioFOpenFile(const char *filename, const char *mode = "rb", Subdirectory subdir = NEWGRF_DIR, size_t *filesize = NULL); -bool FioCheckFileExists(const char *filename, Subdirectory subdir = NEWGRF_DIR); +FILE *FioFOpenFile(const char *filename, const char *mode, Subdirectory subdir, size_t *filesize = NULL); +bool FioCheckFileExists(const char *filename, Subdirectory subdir); char *FioGetFullPath(char *buf, size_t buflen, Searchpath sp, Subdirectory subdir, const char *filename); char *FioFindFullPath(char *buf, size_t buflen, Subdirectory subdir, const char *filename); char *FioAppendDirectory(char *buf, size_t buflen, Searchpath sp, Subdirectory subdir);
--- a/src/fios.cpp +++ b/src/fios.cpp @@ -599,7 +599,7 @@ /* virtual */ bool AddFile(const char *filename, size_t basepath_length) { - FILE *f = FioFOpenFile(filename, "r"); + FILE *f = FioFOpenFile(filename, "r", SCENARIO_DIR); if (f == NULL) return false; ScenarioIdentifier id;
--- a/src/heightmap.cpp +++ b/src/heightmap.cpp @@ -105,7 +105,7 @@ png_structp png_ptr = NULL; png_infop info_ptr = NULL; - fp = FioFOpenFile(filename, "rb"); + fp = FioFOpenFile(filename, "rb", HEIGHTMAP_DIR); if (fp == NULL) { ShowErrorMessage(STR_ERROR_PNGMAP, STR_ERROR_PNGMAP_FILE_NOT_FOUND, WL_ERROR); return false; @@ -228,7 +228,7 @@ /* Init BmpData */ memset(&data, 0, sizeof(data)); - f = FioFOpenFile(filename, "rb"); + f = FioFOpenFile(filename, "rb", HEIGHTMAP_DIR); if (f == NULL) { ShowErrorMessage(STR_ERROR_BMPMAP, STR_ERROR_PNGMAP_FILE_NOT_FOUND, WL_ERROR); return false;
--- a/src/saveload/oldloader.cpp +++ b/src/saveload/oldloader.cpp @@ -281,7 +281,7 @@ InitLoading(&ls); /* Open file */ - ls.file = FioFOpenFile(file, "rb"); + ls.file = FioFOpenFile(file, "rb", NO_DIRECTORY); if (ls.file == NULL) { DEBUG(oldloader, 0, "Cannot open file '%s'", file); @@ -320,7 +320,7 @@ void GetOldSaveGameName(const char *file, char *title, const char *last) { - FILE *f = FioFOpenFile(file, "rb"); + FILE *f = FioFOpenFile(file, "rb", NO_DIRECTORY); if (f == NULL) { *title = '\0';
--- a/src/spriteloader/png.cpp +++ b/src/spriteloader/png.cpp @@ -42,7 +42,7 @@ /* Add path separator after 'sprites' if not present */ 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)) { + if (FioCheckFileExists(png_file, NEWGRF_DIR)) { FioOpenFile(PNG_SLOT, png_file, NEWGRF_DIR); return true; }