summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-08-24 13:35:46 +0000
committerrubidium <rubidium@openttd.org>2011-08-24 13:35:46 +0000
commit5f06d5067f861031dedd8de0ce0d21cd6f70a9a7 (patch)
tree17cd9bd45629dbabc8c4d05b7f5d3ea32866d7f6 /src
parent0061b5f1842776ff4d69bf9f3bcdfb348b2f5a76 (diff)
downloadopenttd-5f06d5067f861031dedd8de0ce0d21cd6f70a9a7.tar.xz
(svn r22823) -Codechange: pass the sub directory to search in to GetFileTitle
Diffstat (limited to 'src')
-rw-r--r--src/fios.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/fios.cpp b/src/fios.cpp
index ba2f84ded..f30b38210 100644
--- a/src/fios.cpp
+++ b/src/fios.cpp
@@ -364,14 +364,15 @@ static void FiosGetFileList(SaveLoadDialogMode mode, fios_getlist_callback_proc
* @param file filename to get the title for
* @param title the title buffer to fill
* @param last the last element in the title buffer
+ * @param subdir the sub directory to search in
*/
-static void GetFileTitle(const char *file, char *title, const char *last)
+static void GetFileTitle(const char *file, char *title, const char *last, Subdirectory subdir)
{
char buf[MAX_PATH];
strecpy(buf, file, lastof(buf));
strecat(buf, ".title", lastof(buf));
- FILE *f = FioFOpenFile(buf, "r");
+ FILE *f = FioFOpenFile(buf, "r", subdir);
if (f == NULL) return;
size_t read = fread(title, 1, last - title, f);
@@ -400,7 +401,7 @@ FiosType FiosGetSavegameListCallback(SaveLoadDialogMode mode, const char *file,
* .SV1 Transport Tycoon Deluxe (Patch) saved game
* .SV2 Transport Tycoon Deluxe (Patch) saved 2-player game */
if (strcasecmp(ext, ".sav") == 0) {
- GetFileTitle(file, title, last);
+ GetFileTitle(file, title, last, SAVE_DIR);
return FIOS_TYPE_FILE;
}
@@ -452,7 +453,7 @@ static FiosType FiosGetScenarioListCallback(SaveLoadDialogMode mode, const char
* .SV0 Transport Tycoon Deluxe (Patch) scenario
* .SS0 Transport Tycoon Deluxe preset scenario */
if (strcasecmp(ext, ".scn") == 0) {
- GetFileTitle(file, title, last);
+ GetFileTitle(file, title, last, SCENARIO_DIR);
return FIOS_TYPE_SCENARIO;
}
@@ -528,7 +529,7 @@ static FiosType FiosGetHeightmapListCallback(SaveLoadDialogMode mode, const char
if (!match) return FIOS_TYPE_INVALID;
}
- GetFileTitle(file, title, last);
+ GetFileTitle(file, title, last, HEIGHTMAP_DIR);
return type;
}