MCPcopy Create free account
hub / github.com/ZDoom/Raze / M_Autosave

Function M_Autosave

source/core/savegamehelp.cpp:858–882  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

856 //---------------------------------------------------------------------------
857
858void M_Autosave()
859{
860 if (disableautosave) return;
861 if (!gi->CanSave()) return;
862 FString description;
863 FString file;
864 // Keep a rotating sets of autosaves
865 UCVarValue num;
866 const char* readableTime;
867 int count = autosavecount != 0 ? autosavecount : 1;
868
869 if (nextautosave == -1)
870 {
871 nextautosave = (autosavenum + 1) % count;
872 }
873
874 num.Int = nextautosave;
875 autosavenum->ForceSet(num, CVAR_Int);
876
877 auto Filename = G_BuildSaveName(FStringf("auto%04d", nextautosave).GetChars());
878 readableTime = myasctime();
879 FStringf SaveTitle("Autosave %s", readableTime);
880 nextautosave = (nextautosave + 1) % count;
881 G_DoSaveGame(false, false, Filename.GetChars(), SaveTitle.GetChars());
882}
883
884CCMD(autosave)
885{

Callers 1

GameTickerFunction · 0.85

Calls 7

G_BuildSaveNameFunction · 0.85
FStringfClass · 0.85
myasctimeFunction · 0.85
G_DoSaveGameFunction · 0.85
ForceSetMethod · 0.80
CanSaveMethod · 0.45
GetCharsMethod · 0.45

Tested by

no test coverage detected