| 856 | //--------------------------------------------------------------------------- |
| 857 | |
| 858 | void 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 | |
| 884 | CCMD(autosave) |
| 885 | { |
no test coverage detected