summaryrefslogtreecommitdiff
path: root/src/saveload.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-01-02 22:49:43 +0000
committerrubidium <rubidium@openttd.org>2009-01-02 22:49:43 +0000
commit3a0d966ae408aecc0bdad3325c1cc75927d58e89 (patch)
tree13fdf7e39e9d4d152f31d1a3441b07c4b8be91c5 /src/saveload.cpp
parent1357b0a4c2c9cb2cf6d81a2cbc3e851d25c6c735 (diff)
downloadopenttd-3a0d966ae408aecc0bdad3325c1cc75927d58e89.tar.xz
(svn r14790) -Codechange: unify generation of default savegame/screenshot names (PhilSophus)
Diffstat (limited to 'src/saveload.cpp')
-rw-r--r--src/saveload.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/saveload.cpp b/src/saveload.cpp
index 968e48911..79c81731c 100644
--- a/src/saveload.cpp
+++ b/src/saveload.cpp
@@ -29,6 +29,8 @@
#include "functions.h"
#include "core/endian_func.hpp"
#include "vehicle_base.h"
+#include "company_func.h"
+#include "date_func.h"
#include "autoreplace_base.h"
#include "statusbar_gui.h"
#include "fileio_func.h"
@@ -1817,6 +1819,21 @@ void DoExitSave()
SaveOrLoad("exit.sav", SL_SAVE, AUTOSAVE_DIR);
}
+/**
+ * Fill the buffer with the default name for a savegame *or* screenshot.
+ * @param buf the buffer to write to.
+ * @param last the last element in the buffer.
+ */
+void GenerateDefaultSaveName(char *buf, const char *last)
+{
+ /* Check if we are not a spectator who wants to generate a name..
+ * Let's use the name of company #0 for now. */
+ SetDParam(0, IsValidCompanyID(_local_company) ? _local_company : COMPANY_FIRST);
+ SetDParam(1, _date);
+ GetString(buf, STR_4004, last);
+ SanitizeFilename(buf);
+}
+
#if 0
/**
* Function to get the type of the savegame by looking at the file header.