changeset 18014:0c0d50f3519a draft

(svn r22823) -Codechange: pass the sub directory to search in to GetFileTitle
author rubidium <rubidium@openttd.org>
date Wed, 24 Aug 2011 13:35:46 +0000
parents 7a582ee01092
children 7f4c6ab61bcc
files src/fios.cpp
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/fios.cpp
+++ b/src/fios.cpp
@@ -364,14 +364,15 @@
  * @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 @@
 	 * .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 @@
 	 * .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 @@
 		if (!match) return FIOS_TYPE_INVALID;
 	}
 
-	GetFileTitle(file, title, last);
+	GetFileTitle(file, title, last, HEIGHTMAP_DIR);
 
 	return type;
 }