git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6843 e016b1c5-ed68-44aa-a2f7-31cac88cffde
31 lines
1.2 KiB
INI
31 lines
1.2 KiB
INI
persistidents 0
|
|
checkinit mapstartalways [ if $autosavemap autoSaveCheck; numAutoSaves = 0 ]
|
|
checkinit onNewMap [ if $autosavemap autoSaveCheck; numAutoSaves = 0 ]
|
|
check2init autosavemap 0 // Autosavemap system disabled by default
|
|
check2init timeBetAutoSaves 300000 // Once every 5 minutes.
|
|
check2init numAutoSaveBackups 12 // Make a map .bak every 12 autosaves by default
|
|
|
|
const autoSaveCheck [ sleep $timeBetAutoSaves [ doAutoSave ] 1 ]
|
|
|
|
const execAutoSave [
|
|
+= numAutoSaves 1
|
|
oldmapbackups = $mapbackupsonsave
|
|
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.
|
|
]
|
|
|
|
const doAutoSave [
|
|
if $autosavemap [
|
|
if (&& (! (strstr $defaultmaps (curmap 1))) (strlen (curmap 1))) [
|
|
if $editing execAutoSave [
|
|
if (= $gamemode (coop -1)) execAutoSave
|
|
]
|
|
]
|
|
]
|
|
autoSaveCheck
|
|
]
|
|
|
|
addListOnQuit "autoSaveCheck execAutoSave doAutoSave numAutoSaves oldmapbackups"
|
|
persistidents 1 |