ddnet/src/game/editor
Robert Müller 1810d972f4 Autosave copy of current editor map periodically to auto folder
A copy of the map currently open in the editor is saved every 10 minutes to the `maps/auto` folder (interval configurable, see below). The automatically saved map uses the filename of the original map with an additional timestamp. Per map name 10 autosaves are kept in the `auto` folder before old autosaves will be deleted (number configurable, see below).

Add config variable `ed_autosave_interval` (0 - 240, default 10) to configure the interval in minutes at which a copy of the current editor map is automatically saved to the 'auto' folder.

Add config variable `ed_autosave_max` (0 - 1000, default 10) to configure the maximum number of autosaves that are kept per map name (0 = no limit).

Autosaving will not take place in the 5 seconds immediately after the map was last modified by the user, to avoid interrupting the user with the autosave.
This will only delay autosaving for up to 1 minute though, so autosaves are not prevented entirely, should the user continuously edit the map.

When the editor is reopened after being closed for more than 10 seconds, the autosave timer will be adjusted to compensate for the time that was not spent on editing in the editor.

When the map is saved manually by the user the autosave file is also updated, if it's outdated by at least half of the configured autosave interval. This ensures that autosaves are always available as a periodic backup of the map.

When a copy of the current map is saved, this does not update the autosave and will also no longer reset the modified state. The modified state should reflect whether changes have been made that are not saved to the current map file. As saving a copy does not update the current file, the modified state should not be reset in this case.

Closes #6693.
2023-06-26 21:58:04 +02:00
..
auto_map.cpp Autosave copy of current editor map periodically to auto folder 2023-06-26 21:58:04 +02:00
auto_map.h Format vector variables names (fixes #5209) 2022-06-11 21:38:49 +02:00
editor.cpp Autosave copy of current editor map periodically to auto folder 2023-06-26 21:58:04 +02:00
editor.h Autosave copy of current editor map periodically to auto folder 2023-06-26 21:58:04 +02:00
explanations.cpp Rename TILE_CHECKPOINT_XXX to TILE_TIME_CHECKPOINT_XXX 2022-06-30 23:41:40 +02:00
io.cpp Autosave copy of current editor map periodically to auto folder 2023-06-26 21:58:04 +02:00
layer_game.cpp Refactor str_copy usages and buffer sizes in editor 2023-06-13 20:45:51 +02:00
layer_quads.cpp Autosave copy of current editor map periodically to auto folder 2023-06-26 21:58:04 +02:00
layer_sounds.cpp Autosave copy of current editor map periodically to auto folder 2023-06-26 21:58:04 +02:00
layer_tiles.cpp Autosave copy of current editor map periodically to auto folder 2023-06-26 21:58:04 +02:00
popups.cpp Autosave copy of current editor map periodically to auto folder 2023-06-26 21:58:04 +02:00