(svn r14790) -Codechange: unify generation of default savegame/screenshot names (PhilSophus)
This commit is contained in:
@@ -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.
|
||||
|
Reference in New Issue
Block a user