interval for scenedit autosave
This commit is contained in:
@@ -1101,13 +1101,12 @@ struct overrides_sheet {
|
||||
}
|
||||
};
|
||||
|
||||
const int MAX_ED_AUTOSAVE_DEFAULT = 10; // TODO make a pref
|
||||
static fs::path next_autosave_path() {
|
||||
extern fs::path edAutoDir;
|
||||
|
||||
auto ed_autosaves = sorted_file_mtimes(edAutoDir, {".boes"});
|
||||
|
||||
if(ed_autosaves.size() >= MAX_ED_AUTOSAVE_DEFAULT){
|
||||
if(ed_autosaves.size() >= get_int_pref("EdAutoSlots", 10)){ // TODO allow changing the pref
|
||||
return ed_autosaves.back().first; // Reuse oldest auto slot
|
||||
}else if(ed_autosaves.empty()){
|
||||
return edAutoDir / "auto0.boes";
|
||||
|
||||
@@ -195,8 +195,15 @@ static void launch_scenario(eLaunchType type) {
|
||||
//Changed to ISO C specified argument and return type.
|
||||
int main(int argc, char* argv[]) {
|
||||
extern cUndoList undo_list;
|
||||
undo_list.onChange = []() -> void {
|
||||
save_scenario(false, true);
|
||||
int change_counter = 0;
|
||||
undo_list.onChange = [&change_counter]() -> void {
|
||||
++change_counter;
|
||||
// TODO allow setting this pref (min 1)
|
||||
if(change_counter == get_int_pref("EdAutoInterval", 3)){
|
||||
save_scenario(false, true);
|
||||
change_counter = 0;
|
||||
}
|
||||
|
||||
};
|
||||
try {
|
||||
init_scened(argc, argv);
|
||||
|
||||
Reference in New Issue
Block a user