summaryrefslogtreecommitdiff
path: root/src/saveload/saveload.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/saveload/saveload.cpp')
-rw-r--r--src/saveload/saveload.cpp33
1 files changed, 33 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.