Try to sanitize the exec+pullin mess

- Old mess:
  * Execute autoexec files right away.
  * Execute -exec files right away.
  * Execute command line commands right away.
    - If, during any of the above, an unknown command or a set of an
      unknown variable is encountered, store it for later.
    - Pullin commands are directly executed and add to the list of files
      to load.
  * Do a little setup, including parsing CVARINFOs.
  * Retry saved commands in case CVARINFO added a cvar they refer to.
- New, less messy, mess:
  * Parse autoexec files into an array.
  * Parse -exec files.
  * Parse command line commands.
    - During all of the above, exec commands are also parsed into the
      array immediately rather than being saved for execution later.
    - Pullin commands are parsed into a different array. The pullin
      command doesn't actually do anything directly anymore.
  * Add all the pullin files to the list of files to load.
  * Do a little setup, including parsing CVARINFOs.
  * Execute every command that was parsed in the preceding steps.
This commit is contained in:
Randy Heit 2015-04-07 12:37:33 -05:00
commit 6428b399d6
4 changed files with 163 additions and 150 deletions

View file

@ -450,11 +450,10 @@ CCMD (exec)
for (int i = 1; i < argv.argc(); ++i)
{
switch (C_ExecFile (argv[i], gamestate == GS_STARTUP))
if (!C_ExecFile(argv[i]))
{
case 1: Printf ("Could not open \"%s\"\n", argv[1]); break;
case 2: Printf ("Error parsing \"%s\"\n", argv[1]); break;
default: break;
Printf ("Could not exec \"%s\"\n", argv[i]);
break;
}
}
}