persistidents cleanup

Restore the old persistidents system from AC 1.0, since it's working as
intended - if used properly.

As a reminder:

  * aliases created by "const" and "tempalias" are never persistent
  * aliases created or altered by "alias" or "=" become persistent, if
    the persistidents flag is set during that operation
  * persistidents if false during the execution of almost all config files
    during game start - those files can create aliases with default values
    which will not be persistent (until changed later while the flag is
    set)
  * before saved.cfg is executed, the flag is set and stays set all
    throughout the game - which means, that all changes (from menus, for
    example) will change the altered alias to "persistent"
  * exceptions for map or model config files are unnecessary, since those
    run restricted and can't create aliases anyway
  * exceptions are necessary for "late run" config files like those in
    config/opt/

The new command "persistidents" may be used to manually set or clear the
flag. It also returns the current state of the flag. If used in a config
file, the flag is restored to its original value when the file ends
execution.

In short: only late-run config files (meaning: run after saved.cfg was
restored) may need to manually set/reset the flag. Use const and tempalias
where appropriate and clear persistidents before creating an alias with a
not-to-save default value that may be changed and made persistent later.

DOCREF persistidents
This commit is contained in:
ac-stef
2017-05-05 15:50:59 +02:00
parent fc82b82b85
commit b650fca2ca
25 changed files with 26 additions and 88 deletions
-3
View File
@@ -1,5 +1,3 @@
persistidents 0
const kick [if $numargs [if (> $numargs 1) [loop i (- $numargs 2) [alias arg2 (concat $arg2 (getalias (concatword arg (+ $i 3)))) ] ] [] ; callvote 0 $arg1 $arg2 ] ]
const ban [if $numargs [if (> $numargs 1) [loop i (- $numargs 2) [alias arg2 (concat $arg2 (getalias (concatword arg (+ $i 3)))) ] ] [] ; callvote 1 $arg1 $arg2 ] ]
const removebans [ callvote 2 $arg1 ]
@@ -25,4 +23,3 @@ const demo [
]
]
persistidents 1