summaryrefslogtreecommitdiff
path: root/src/console_cmds.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/console_cmds.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/console_cmds.cpp')
-rw-r--r--src/console_cmds.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp
index 0fe85c86d..5f3f320b6 100644
--- a/src/console_cmds.cpp
+++ b/src/console_cmds.cpp
@@ -19,6 +19,7 @@
#include "command.h"
#include "settings.h"
#include "fios.h"
+#include "fileio.h"
#include "vehicle.h"
#include "station.h"
#include "strings.h"
@@ -173,7 +174,6 @@ DEF_CONSOLE_CMD(ConScrollToTile)
return false;
}
-extern bool SafeSaveOrLoad(const char *filename, int mode, int newgm);
extern void BuildFileList();
extern void SetFiosType(const byte fiostype);
@@ -186,16 +186,15 @@ DEF_CONSOLE_CMD(ConSave)
}
if (argc == 2) {
- char buf[200];
-
- snprintf(buf, lengthof(buf), "%s%s%s.sav", _paths.save_dir, PATHSEP, argv[1]);
+ char *filename = str_fmt("%s.sav", argv[1]);
IConsolePrint(_icolour_def, "Saving map...");
- if (SaveOrLoad(buf, SL_SAVE) != SL_OK) {
- IConsolePrint(_icolour_err, "SaveMap failed");
+ if (SaveOrLoad(filename, SL_SAVE, SAVE_DIR) != SL_OK) {
+ IConsolePrint(_icolour_err, "Saving map failed");
} else {
- IConsolePrintF(_icolour_def, "Map sucessfully saved to %s", buf);
+ IConsolePrintF(_icolour_def, "Map sucessfully saved to %s", filename);
}
+ free(filename);
return true;
}