diff options
Diffstat (limited to 'src/saveload.cpp')
-rw-r--r-- | src/saveload.cpp | 17 |
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. |