diff options
author | bjarni <bjarni@openttd.org> | 2005-11-17 19:43:37 +0000 |
---|---|---|
committer | bjarni <bjarni@openttd.org> | 2005-11-17 19:43:37 +0000 |
commit | eba1f68439364236de7ae3c7792e2a87cfbcf670 (patch) | |
tree | 58b3df375737d146806314ed1b4a8e83dffbdac1 /openttd.c | |
parent | 3e702afc08bd8118f5b01e6493fcdea1aea4c0d4 (diff) | |
download | openttd-eba1f68439364236de7ae3c7792e2a87cfbcf670.tar.xz |
(svn r3214) -Feature: openttd.cfg can now set how many autosaves to keep before starting to overwrite old ones
max_autosave_num in the config files sets the number of autosaves to keep (default 16)
MAX_NUM_AUTOSAVES in Makefile.config sets the default value. 16 is used if no value is given
this behaviour can still be overwritten by keep_all_autosave (openttd.config setting)
Note: this is a requested behaviour for PDA ports, since they got limited storage space
Diffstat (limited to 'openttd.c')
-rw-r--r-- | openttd.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -888,10 +888,14 @@ static void DoAutosave(void) SetDParam(2, _date); s = GetString(buf + strlen(_path.autosave_dir) + strlen(PATHSEP), STR_4004); strcpy(s, ".sav"); - } else { /* Save a maximum of 15 autosaves */ - int n = _autosave_ctr; - _autosave_ctr = (_autosave_ctr + 1) & 15; - sprintf(buf, "%s%sautosave%d.sav", _path.autosave_dir, PATHSEP, n); + } else { /* generate a savegame name and number according to _patches.max_num_autosaves */ + sprintf(buf, "%s%sautosave%d.sav", _path.autosave_dir, PATHSEP, _autosave_ctr); + + _autosave_ctr++; + if (_autosave_ctr >= _patches.max_num_autosaves) { + // we reached the limit for numbers of autosaves. We will start over + _autosave_ctr = 0; + } } DEBUG(misc, 2) ("Autosaving to %s", buf); |