summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2016-09-04 12:47:07 +0000
committeralberth <alberth@openttd.org>2016-09-04 12:47:07 +0000
commit2fa0fdb1768f45ffaf4fe14fbdbdb73d501d6c36 (patch)
treeffe7234137f524ab7c0ebf484c9d383e56311333 /src/saveload
parent3b8ede5ebe74bafba528f0bf40942c1367cbcaee (diff)
downloadopenttd-2fa0fdb1768f45ffaf4fe14fbdbdb73d501d6c36.tar.xz
(svn r27638) -Codechange: Move FiosType enum, move and rename SetFiosType function.
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/saveload.cpp33
-rw-r--r--src/saveload/saveload.h2
2 files changed, 35 insertions, 0 deletions
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index 03c0cb8c8..007b22f01 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -2892,6 +2892,39 @@ void GenerateDefaultSaveName(char *buf, const char *last)
SanitizeFilename(buf);
}
+/**
+ * Set the mode of the file to save or load based on the type of file entry at the file system.
+ * @param ft Type of file entry of the file system.
+ */
+void FileToSaveLoad::SetMode(FiosType ft)
+{
+ switch (ft) {
+ case FIOS_TYPE_FILE:
+ case FIOS_TYPE_SCENARIO:
+ this->mode = SL_LOAD;
+ break;
+
+ case FIOS_TYPE_OLDFILE:
+ case FIOS_TYPE_OLD_SCENARIO:
+ this->mode = SL_OLD_LOAD;
+ break;
+
+#ifdef WITH_PNG
+ case FIOS_TYPE_PNG:
+ this->mode = SL_PNG;
+ break;
+#endif /* WITH_PNG */
+
+ case FIOS_TYPE_BMP:
+ this->mode = SL_BMP;
+ break;
+
+ default:
+ this->mode = SL_INVALID;
+ break;
+ }
+}
+
#if 0
/**
* Function to get the type of the savegame by looking at the file header.
diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h
index 450fe58fe..43b9d5d3c 100644
--- a/src/saveload/saveload.h
+++ b/src/saveload/saveload.h
@@ -39,6 +39,8 @@ struct FileToSaveLoad {
AbstractFileType filetype; ///< what type of file are we dealing with
char name[MAX_PATH]; ///< name
char title[255]; ///< internal name of the game
+
+ void SetMode(FiosType ft);
};
/** Types of save games. */