View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0002682||The Dark Mod||Saving/Loading||public||07.03.2011 23:08||12.05.2013 20:07|
|Product Version||TDM 1.04|
|Target Version||TDM 2.00||Fixed in Version||TDM 2.00|
|Summary||0002682: savegame names with dots overwrite each other|
|Description||Saving under the name "test 1.03" and "test 1.04" means that both save games get written as "test_1.save", and thus the latter save game overwrites the former without warning or error.|
|Tags||No tags attached.|
All the process from GUI to naming and opening save files is inside Doom3 engine (perhaps someone with knowledge in GUI knows better if any TDM code is executed when the user clicks on save?). gamex86 gets control first time only in idGameLocal::SaveGame when the save file is already opened. So to fix the problem we have to change something in Doom3's behavior.
I can try to set a hook on opening files (idFileSystem::OpenFileWrite), but I don't know what to do in this hook. I can of course rename all the save files in case they already exist. But then user won't be able to overwrite his saves=)
Reason for this bug is simple. Menu command for save is:
"play sound/meta/menu/mnu_select; saveGame 1 ; close"
Where "1" means "overwrite".
It was ment to overwrite only "the same" save, but it actually overwrites any save whose display name filtered by idSessionLocal::ScrubSaveGameFileName() is equivalent.
Bad, and unused in this case, overwrite check is handled in idSessionLocal::HandleSaveGameMenuCommand(). Overwriting happens in idSessionLocal::SaveGame() - without checking if we're overwriting save with the same displayed name (saveName) or a slightly different one.
Partial and bad solution:
- replace inFileName.StripFileExtension() in ScrubSaveGameFileName() with "remove '.save' from the end"
Complete solution, that won't break current saves:
scrubedName = ScrubSaveGameFileName(saveName)
- from "scrubedName*.save" find filename that is associated with our display name (check all candidates, since there can be gaps in numeration),
- if not found get first free filename "scrubedName<idx>.save",
- make sure that loading can cope with that.
Fixed with revision #5761. Only ".save" is now removed from the string, the result has then special chars replaced by "_".
Empty strings (like ".save" and ".save.save" etc) result in "default".
This minimizes the impact the replacement has.
It is still possible to have filenames clash with "test.1.03" and "test 1.03", which both result in "test_1_03.save" as filename, but it's better than before.
|07.03.2011 23:08||tels||New Issue|
|11.03.2011 06:21||tels||Severity||normal => major|
|12.07.2011 13:49||stgatilov||Note Added: 0003922|
|10.02.2013 02:37||Zbyl||Note Added: 0005062|
|10.02.2013 12:51||Zbyl||Note Edited: 0005062||View Revisions|
|12.05.2013 14:23||tels||Assigned To||=> tels|
|12.05.2013 14:23||tels||Status||new => assigned|
|12.05.2013 19:40||tels||Target Version||=> TDM 2.00|
|12.05.2013 20:07||tels||Note Added: 0005428|
|12.05.2013 20:07||tels||Status||assigned => resolved|
|12.05.2013 20:07||tels||Fixed in Version||=> TDM 2.00|
|12.05.2013 20:07||tels||Resolution||open => fixed|