AGS: Do not attempt to rename savegames after deleting one

The original AGS engine, after removing a savegames, renames
the savegames with the highest slot to fill the gap. The code
does not work in ScummVM however, and furthermore it might
not be a good idea to do it. So in ScummVM we no longer try
to do it. A comment has been added to indicate why it doesn't
work and how it can be fixed, as well as to explain why it
might not be a good idea to do it in ScummVM.
This commit is contained in:
Thierry Crozat 2021-04-16 01:00:27 +01:00
parent 5fde2a493c
commit bb85f7aad9

View File

@ -110,6 +110,18 @@ void DeleteSaveSlot(int slnum) {
String nametouse;
nametouse = get_save_game_path(slnum);
Shared::File::DeleteFile(nametouse);
// The code below renames the highest save game to fill in the gap
// This does not work (because the system rename() function does not
// handle our "/saves/" prefix). We could remove it here and use
// g_system->getSavefileManager()->renameSavefile. But it might
// actually be better to not fill the gap. The original AGS engine
// sorts savegame by date, but as we don't have access to the date,
// we save them by slot. So moving the highest slot to the gap may
// not be a good idea. An alternative would be to shift by one all
// the savegames after the removed one.
// One aspect to keep in mind is that MAXSAVEGAMES is 50, but we
// allow slot up to 099. So we have some margin.
#ifndef AGS_PLATFORM_SCUMMVM
if ((slnum >= 1) && (slnum <= MAXSAVEGAMES)) {
String thisname;
for (int i = MAXSAVEGAMES; i > slnum; i--) {
@ -122,6 +134,7 @@ void DeleteSaveSlot(int slnum) {
}
}
#endif
}
void PauseGame() {