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:
parent
e4cadc90a5
commit
6428b399d6
4 changed files with 163 additions and 150 deletions
|
|
@ -1723,12 +1723,13 @@ bool ConsiderPatches (const char *arg)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void D_MultiExec (DArgs *list, bool usePullin)
|
||||
FExecList *D_MultiExec (DArgs *list, FExecList *exec)
|
||||
{
|
||||
for (int i = 0; i < list->NumArgs(); ++i)
|
||||
{
|
||||
C_ExecFile (list->GetArg (i), usePullin);
|
||||
exec = C_ParseExecFile(list->GetArg(i), exec);
|
||||
}
|
||||
return exec;
|
||||
}
|
||||
|
||||
static void GetCmdLineFiles(TArray<FString> &wadfiles)
|
||||
|
|
@ -2291,18 +2292,24 @@ void D_DoomMain (void)
|
|||
|
||||
AddAutoloadFiles(iwad_info->Autoname);
|
||||
|
||||
// Run automatically executed files
|
||||
// Process automatically executed files
|
||||
FExecList *exec;
|
||||
execFiles = new DArgs;
|
||||
GameConfig->AddAutoexec (execFiles, gameinfo.ConfigName);
|
||||
D_MultiExec (execFiles, true);
|
||||
GameConfig->AddAutoexec(execFiles, gameinfo.ConfigName);
|
||||
exec = D_MultiExec(execFiles, NULL);
|
||||
|
||||
// Run .cfg files at the start of the command line.
|
||||
// Process .cfg files at the start of the command line.
|
||||
execFiles = Args->GatherFiles ("-exec");
|
||||
D_MultiExec (execFiles, true);
|
||||
exec = D_MultiExec(execFiles, exec);
|
||||
|
||||
C_ExecCmdLineParams (); // [RH] do all +set commands on the command line
|
||||
// [RH] process all + commands on the command line
|
||||
exec = C_ParseCmdLineParams(exec);
|
||||
|
||||
CopyFiles(allwads, pwads);
|
||||
if (exec != NULL)
|
||||
{
|
||||
exec->AddPullins(allwads);
|
||||
}
|
||||
|
||||
// Since this function will never leave we must delete this array here manually.
|
||||
pwads.Clear();
|
||||
|
|
@ -2324,8 +2331,13 @@ void D_DoomMain (void)
|
|||
// Now that wads are loaded, define mod-specific cvars.
|
||||
ParseCVarInfo();
|
||||
|
||||
// Try setting previously unknown cvars again, as a CVARINFO may have made them known.
|
||||
C_ExecStoredSets();
|
||||
// Actually exec command line commands and exec files.
|
||||
if (exec != NULL)
|
||||
{
|
||||
exec->ExecCommands();
|
||||
delete exec;
|
||||
exec = NULL;
|
||||
}
|
||||
|
||||
// [RH] Initialize localizable strings.
|
||||
GStrings.LoadStrings (false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue