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() {
|
static fs::path next_autosave_path() {
|
||||||
extern fs::path edAutoDir;
|
extern fs::path edAutoDir;
|
||||||
|
|
||||||
auto ed_autosaves = sorted_file_mtimes(edAutoDir, {".boes"});
|
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
|
return ed_autosaves.back().first; // Reuse oldest auto slot
|
||||||
}else if(ed_autosaves.empty()){
|
}else if(ed_autosaves.empty()){
|
||||||
return edAutoDir / "auto0.boes";
|
return edAutoDir / "auto0.boes";
|
||||||
|
|||||||
@@ -195,8 +195,15 @@ static void launch_scenario(eLaunchType type) {
|
|||||||
//Changed to ISO C specified argument and return type.
|
//Changed to ISO C specified argument and return type.
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
extern cUndoList undo_list;
|
extern cUndoList undo_list;
|
||||||
undo_list.onChange = []() -> void {
|
int change_counter = 0;
|
||||||
save_scenario(false, true);
|
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 {
|
try {
|
||||||
init_scened(argc, argv);
|
init_scened(argc, argv);
|
||||||
|
|||||||
Reference in New Issue
Block a user