summaryrefslogtreecommitdiff
path: root/src/saveload.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-06-17 15:48:57 +0000
committerrubidium <rubidium@openttd.org>2007-06-17 15:48:57 +0000
commit347c28b71ac754aee20f8eeeae1df1a3b9a49d10 (patch)
tree8bc2a050b44170ed785af66e6e9045d429c789db /src/saveload.cpp
parent5fdde681c2aff0976eef8cea59422332527b3a65 (diff)
downloadopenttd-347c28b71ac754aee20f8eeeae1df1a3b9a49d10.tar.xz
(svn r10182) -Codechange: rewrite most part of the file loading/searching to be more flexible.
-Codechange: add support for personal directories on Windows. -Fix [FS#153, FS#193, FS#502, FS#816, FS#854]: fix issues related to fixed names, fixed places of files/directories and application bundles.
Diffstat (limited to 'src/saveload.cpp')
-rw-r--r--src/saveload.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/saveload.cpp b/src/saveload.cpp
index 420e5e98a..4b1f12bf8 100644
--- a/src/saveload.cpp
+++ b/src/saveload.cpp
@@ -1561,7 +1561,7 @@ void WaitTillSaved()
* @param mode Save or load. Load can also be a TTD(Patch) game. Use SL_LOAD, SL_OLD_LOAD or SL_SAVE
* @return Return the results of the action. SL_OK, SL_ERROR or SL_REINIT ("unload" the game)
*/
-SaveOrLoadResult SaveOrLoad(const char *filename, int mode)
+SaveOrLoadResult SaveOrLoad(const char *filename, int mode, Subdirectory sb)
{
uint32 hdr[2];
const SaveLoadFormat *fmt;
@@ -1583,7 +1583,7 @@ SaveOrLoadResult SaveOrLoad(const char *filename, int mode)
return SL_OK;
}
- _sl.fh = (mode == SL_SAVE) ? fopen(filename, "wb") : fopen(filename, "rb");
+ _sl.fh = (mode == SL_SAVE) ? FioFOpenFile(filename, "wb", sb) : FioFOpenFile(filename, "rb", sb);
if (_sl.fh == NULL) {
DEBUG(sl, 0, "Cannot open savegame '%s' for saving/loading.", filename);
return SL_ERROR;
@@ -1721,9 +1721,7 @@ SaveOrLoadResult SaveOrLoad(const char *filename, int mode)
/** Do a save when exiting the game (patch option) _patches.autosave_on_exit */
void DoExitSave()
{
- char buf[200];
- snprintf(buf, sizeof(buf), "%s%sexit.sav", _paths.autosave_dir, PATHSEP);
- SaveOrLoad(buf, SL_SAVE);
+ SaveOrLoad("exit.sav", SL_SAVE, AUTOSAVE_DIR);
}
#if 0