From 98ca5d5db4b592b7ad803169122dae995f679d71 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 16 May 2021 11:24:08 +0200 Subject: [PATCH] - added 'load' and 'save' CCMDs. --- source/core/savegamehelp.cpp | 44 ++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/source/core/savegamehelp.cpp b/source/core/savegamehelp.cpp index a41b06b40..a2a2022f5 100644 --- a/source/core/savegamehelp.cpp +++ b/source/core/savegamehelp.cpp @@ -844,3 +844,47 @@ CCMD(rotatingquicksave) } +//========================================================================== +// +// CCMD load +// +// Load a saved game. +// +//========================================================================== + +UNSAFE_CCMD(load) +{ + if (argv.argc() != 2) + { + Printf("usage: load \n"); + return; + } + if (netgame) + { + Printf("cannot load during a network game\n"); + return; + } + FString fname = G_BuildSaveName(argv[1]); + G_LoadGame(fname); +} + +//========================================================================== +// +// CCMD save +// +// Save the current game. +// +//========================================================================== + +UNSAFE_CCMD(save) +{ + if (argv.argc() < 2 || argv.argc() > 3) + { + Printf("usage: save [description]\n"); + return; + } + FString fname = G_BuildSaveName(argv[1]); + G_SaveGame(fname, argv.argc() > 2 ? argv[2] : argv[1]); +} + +