- block direct use of 'new' for DObjects.
This is to ensure that the Class pointer can be set right on creation. ZDoom had always depended on handling this lazily which poses some problems for the VM. So now there is a variadic Create<classtype> function taking care of that, but to ensure that it gets used, direct access to the new operator has been blocked. This also neccessitated making DArgs a regular object because they get created before the type system is up. Since the few uses of DArgs are easily controllable this wasn't a big issue. - did a bit of optimization on the bots' decision making whether to pick up a health item or not.
This commit is contained in:
parent
929affa3cb
commit
cd180d29c7
68 changed files with 384 additions and 341 deletions
|
|
@ -1770,7 +1770,7 @@ bool ConsiderPatches (const char *arg)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FExecList *D_MultiExec (DArgs *list, FExecList *exec)
|
||||
FExecList *D_MultiExec (FArgs *list, FExecList *exec)
|
||||
{
|
||||
for (int i = 0; i < list->NumArgs(); ++i)
|
||||
{
|
||||
|
|
@ -1980,7 +1980,8 @@ static void SetMapxxFlag()
|
|||
|
||||
static void FinalGC()
|
||||
{
|
||||
Args = NULL;
|
||||
delete Args;
|
||||
Args = nullptr;
|
||||
GC::FinalGC = true;
|
||||
GC::FullGC();
|
||||
GC::DelSoftRootHead(); // the soft root head will not be collected by a GC so we have to do it explicitly
|
||||
|
|
@ -2264,7 +2265,6 @@ void D_DoomMain (void)
|
|||
int p;
|
||||
const char *v;
|
||||
const char *wad;
|
||||
DArgs *execFiles;
|
||||
TArray<FString> pwads;
|
||||
FString *args;
|
||||
int argcount;
|
||||
|
|
@ -2372,13 +2372,15 @@ void D_DoomMain (void)
|
|||
|
||||
// Process automatically executed files
|
||||
FExecList *exec;
|
||||
execFiles = new DArgs;
|
||||
FArgs *execFiles = new FArgs;
|
||||
GameConfig->AddAutoexec(execFiles, gameinfo.ConfigName);
|
||||
exec = D_MultiExec(execFiles, NULL);
|
||||
delete execFiles;
|
||||
|
||||
// Process .cfg files at the start of the command line.
|
||||
execFiles = Args->GatherFiles ("-exec");
|
||||
exec = D_MultiExec(execFiles, exec);
|
||||
delete execFiles;
|
||||
|
||||
// [RH] process all + commands on the command line
|
||||
exec = C_ParseCmdLineParams(exec);
|
||||
|
|
@ -2747,10 +2749,7 @@ void D_DoomMain (void)
|
|||
|
||||
GC::FullGC(); // perform one final garbage collection after shutdown
|
||||
|
||||
for (DObject *obj = GC::Root; obj; obj = obj->ObjNext)
|
||||
{
|
||||
obj->ClearClass(); // Delete the Class pointer because the data it points to has been deleted. This will automatically be reset if needed.
|
||||
}
|
||||
assert(GC::Root == nullptr);
|
||||
|
||||
restart++;
|
||||
PClass::bShutdown = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue