summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-08-24 13:53:34 +0000
committerrubidium <rubidium@openttd.org>2011-08-24 13:53:34 +0000
commitb4edc30c64b98d35fd35eb53eccd52bfc039c1f7 (patch)
tree4deef2b9a21ab44ef83f59d847bbb883dc34a540 /src
parent8e5f433b22a36b2210c4e7386b476382afad7dd6 (diff)
downloadopenttd-b4edc30c64b98d35fd35eb53eccd52bfc039c1f7.tar.xz
(svn r22827) -Codechange: pass the/a more proper sub directory when opening (some) files instead of the default one
Diffstat (limited to 'src')
-rw-r--r--src/fileio_func.h4
-rw-r--r--src/fios.cpp2
-rw-r--r--src/heightmap.cpp4
-rw-r--r--src/saveload/oldloader.cpp4
-rw-r--r--src/spriteloader/png.cpp2
5 files changed, 8 insertions, 8 deletions
diff --git a/src/fileio_func.h b/src/fileio_func.h
index 475b89814..162ad3b1c 100644
--- a/src/fileio_func.h
+++ b/src/fileio_func.h
@@ -48,8 +48,8 @@ static inline bool IsValidSearchPath(Searchpath sp)
#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);
diff --git a/src/fios.cpp b/src/fios.cpp
index f30b38210..627fdf291 100644
--- a/src/fios.cpp
+++ b/src/fios.cpp
@@ -599,7 +599,7 @@ public:
/* 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;
diff --git a/src/heightmap.cpp b/src/heightmap.cpp
index 8790da59e..07b1e5e2a 100644
--- a/src/heightmap.cpp
+++ b/src/heightmap.cpp
@@ -105,7 +105,7 @@ static bool ReadHeightmapPNG(char *filename, uint *x, uint *y, byte **map)
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 @@ static bool ReadHeightmapBMP(char *filename, uint *x, uint *y, byte **map)
/* 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;
diff --git a/src/saveload/oldloader.cpp b/src/saveload/oldloader.cpp
index 9484fb726..2ea24f33b 100644
--- a/src/saveload/oldloader.cpp
+++ b/src/saveload/oldloader.cpp
@@ -281,7 +281,7 @@ bool LoadOldSaveGame(const char *file)
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 @@ bool LoadOldSaveGame(const char *file)
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';
diff --git a/src/spriteloader/png.cpp b/src/spriteloader/png.cpp
index a1a6aa4a1..d31184385 100644
--- a/src/spriteloader/png.cpp
+++ b/src/spriteloader/png.cpp
@@ -42,7 +42,7 @@ static bool OpenPNGFile(const char *filename, uint32 id, bool mask)
/* 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;
}