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
+1 -4
View File
@@ -259,16 +259,13 @@ struct md2 : vertmodel
loopv(mdl.meshes) mdl.meshes[i]->skin = skin;
if(skin==notexture) { conoutf("could not load model skin for %s", name1); flagmapconfigerror(LWW_MODELERR); }
loadingmd2 = this;
ASSERT(execcontext == IEXC_MDLCFG);
defformatstring(name2)("packages/models/%s/md2.cfg", loadname);
per_idents = false;
neverpersist = true;
if(!execfile(name2))
{
formatstring(name2)("packages/models/%s/md2.cfg", pname);
execfile(name2);
}
neverpersist = false;
per_idents = true;
loadingmd2 = 0;
loopv(parts) parts[i]->scaleverts(scale/16.0f, vec(translate.x, -translate.y, translate.z));
radius = calcradius(zradius);