diff options
author | rubidium <rubidium@openttd.org> | 2007-06-17 15:48:57 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-06-17 15:48:57 +0000 |
commit | 3c7a85fe9456b2bc31f3d29198bf2ec060e176f3 (patch) | |
tree | 8bc2a050b44170ed785af66e6e9045d429c789db /src/saveload.cpp | |
parent | 4e4b152adb9e4fed758748622c66991be2aad730 (diff) | |
download | openttd-3c7a85fe9456b2bc31f3d29198bf2ec060e176f3.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.cpp | 8 |
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 |