diff --git a/config/autosave.cfg b/config/autosave.cfg index 0190c3dd..f849f11d 100644 --- a/config/autosave.cfg +++ b/config/autosave.cfg @@ -1,19 +1,25 @@ if (! (checkalias mapstartalways)) [ mapstartalways = "" ] -if (! (strstr $mapstartalways autoSaveCheck)) [ add2alias mapstartalways [ if $autosavemap autoSaveCheck ] ] +if (! (strstr $mapstartalways autoSaveCheck)) [ add2alias mapstartalways [ if $autosavemap autoSaveCheck; numAutoSaves = 0 ] ] + +if (! (checkalias onNewMap)) [ onNewMap = "" ] +if (! (strstr $onNewMap autoSaveCheck)) [ add2alias onNewMap [ if $autosavemap autoSaveCheck; numAutoSaves = 0 ] ] if (! (checkalias autosavemap)) [ autosavemap = 0 ] if (! (checkalias timeBetAutoSaves)) [ timeBetAutoSaves = 300000 ] // Once every 5 minutes. +if (! (checkalias numAutoSaveBackups)) [ numAutoSaveBackups = 12 ] const autoSaveCheck [ sleep $timeBetAutoSaves [ doAutoSave ] ] const doAutoSave [ - if (! (strstr $defaultmaps (curmap 1))) [ + if (&& (! (strstr $defaultmaps (curmap 1))) (! (strcmp (curmap 1) ""))) [ if (|| $editing (= $gamemode 1)) [ if $autosavemap [ + += numAutoSaves 1 oldmapbackups = $mapbackupsonsave - mapbackupsonsave 0 // Temporarily turn off map backups to avoid clutter. + if (|| (!= $numAutoSaveBackups $numAutoSaves) (= $numAutoSaveBackups 0)) [ mapbackupsonsave 0 ] [ numAutoSaves = 0 ] // Temporarily turn off map backups to avoid clutter. savemap (curmap 1) mapbackupsonsave $oldmapbackups + echo (blue)The map was automatically saved. (white)Next auto-save in (divf $timeBetAutoSaves 60000) minutes. ] ] ] diff --git a/config/menus_edit.cfg b/config/menus_edit.cfg index de8e8b65..691676d8 100644 --- a/config/menus_edit.cfg +++ b/config/menus_edit.cfg @@ -430,4 +430,5 @@ menuitem " 2 [ OK ]" [ newent sound $ambientsoundmenu $soundrad $soundsize newmenu "Editing settings" menuitemslider "Fly speeds multiplier: " 1 5 "$flyspeed" 1 "" [ flyspeed $arg1 ] menuitemcheckbox "Enable auto save map: " "$autosavemap" [ autosavemap = $arg1 ] -menuitemslider "Time between auto saves: " 30000 600000 "$timeBetAutoSaves" 30000 [] [ timeBetAutoSaves = $arg1 ] \ No newline at end of file +menuitemslider "Time between auto saves (in milliseconds): " 30000 600000 "$timeBetAutoSaves" 30000 [] [ timeBetAutoSaves = $arg1 ] +menuitemtextinput "Make a map backup (.BAK) every (# auto saves):" "$numAutoSaveBackups" [ if (testlist $arg1) [ numAutoSaveBackups = $arg1 ] ] [] 4 \ No newline at end of file