MCPcopy Create free account
hub / github.com/ZDoom/Raze / LoadScripts

Function LoadScripts

source/core/zcompile.cpp:81–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79void InitServices();
80
81void LoadScripts()
82{
83 cycle_t timer;
84
85 PType::StaticInit();
86 SetRazeCompileEnvironment();
87 InitThingdef();
88 timer.Reset(); timer.Clock();
89 FScriptPosition::ResetErrorCounter();
90
91 FScriptPosition::StrictErrors = true;
92 ParseScripts();
93 SynthesizeFlagFields();
94
95 FunctionBuildList.Build();
96
97 if (FScriptPosition::ErrorCounter > 0)
98 {
99 I_Error("%d errors during script processing", FScriptPosition::ErrorCounter);
100 }
101 FScriptPosition::ResetErrorCounter();
102
103 timer.Unclock();
104 if (!batchrun) Printf("script parsing took %.2f ms\n", timer.TimeMS());
105
106 for (int i = PClass::AllClasses.Size() - 1; i >= 0; i--)
107 {
108 auto ti = (PClassActor*)PClass::AllClasses[i];
109 if (!ti->IsDescendantOf(RUNTIME_CLASS(DCoreActor))) continue;
110 if (ti->Size == TentativeClass)
111 {
112 if (ti->bOptional)
113 {
114 Printf(TEXTCOLOR_ORANGE "Class %s referenced but not defined\n", ti->TypeName.GetChars());
115 FScriptPosition::WarnCounter++;
116 // the class must be rendered harmless so that it won't cause problems.
117 ti->ParentClass = RUNTIME_CLASS(DCoreActor);
118 ti->Size = sizeof(DCoreActor);
119 }
120 else
121 {
122 Printf(TEXTCOLOR_RED "Class %s referenced but not defined\n", ti->TypeName.GetChars());
123 FScriptPosition::ErrorCounter++;
124 }
125 continue;
126 }
127
128 if (GetDefaultByType(ti) == nullptr)
129 {
130 Printf(TEXTCOLOR_RED "No ActorInfo defined for class '%s'\n", ti->TypeName.GetChars());
131 FScriptPosition::ErrorCounter++;
132 continue;
133 }
134 }
135
136 // Now we may call the scripted OnDestroy method.
137 PClass::bVMOperational = true;
138 InitServices();

Callers 1

RunGameFunction · 0.85

Calls 15

InitThingdefFunction · 0.85
ParseScriptsFunction · 0.85
SynthesizeFlagFieldsFunction · 0.85
I_ErrorFunction · 0.85
PrintfFunction · 0.85
GetDefaultByTypeFunction · 0.85
InitServicesFunction · 0.85
BuildMethod · 0.80
TimeMSMethod · 0.80
IsDescendantOfMethod · 0.80
ResetMethod · 0.45

Tested by

no test coverage detected