summaryrefslogtreecommitdiff
path: root/src/p_saveg.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/p_saveg.c')
-rw-r--r--src/p_saveg.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/p_saveg.c b/src/p_saveg.c
index afd3852d..40b5f988 100644
--- a/src/p_saveg.c
+++ b/src/p_saveg.c
@@ -44,11 +44,36 @@
FILE *save_stream;
int savegamelength;
+// Get the filename of a temporary file to write the savegame to. After
+// the file has been successfully saved, it will be renamed to the
+// real file.
+
+char *P_TempSaveGameFile(void)
+{
+ static char *filename = NULL;
+
+ if (filename == NULL)
+ {
+ filename = malloc(strlen(savegamedir) + 32);
+ }
+
+ sprintf(filename, "%stemp.dsg", savegamedir);
+
+ return filename;
+}
+
+// Get the filename of the save game file to use for the specified slot.
+
char *P_SaveGameFile(int slot)
{
- static char filename[256];
+ static char *filename = NULL;
char basename[32];
+ if (filename == NULL)
+ {
+ filename = malloc(strlen(savegamedir) + 32);
+ }
+
sprintf(basename, DEH_String(SAVEGAMENAME "%d.dsg"), slot);
sprintf(filename, "%s%s", savegamedir, basename);