MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / InitLogicalEntData

Method InitLogicalEntData

core/HalfLife2.cpp:179–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177}
178
179void CHalfLife2::InitLogicalEntData()
180{
181#if SOURCE_ENGINE == SE_TF2 \
182 || SOURCE_ENGINE == SE_DODS \
183 || SOURCE_ENGINE == SE_HL2DM \
184 || SOURCE_ENGINE == SE_CSS \
185 || SOURCE_ENGINE == SE_SDK2013 \
186 || SOURCE_ENGINE == SE_BMS \
187 || SOURCE_ENGINE == SE_BLADE \
188 || SOURCE_ENGINE == SE_NUCLEARDAWN \
189 || SOURCE_ENGINE == SE_PVKII
190
191 if (g_SMAPI->GetServerFactory(false)("VSERVERTOOLS003", nullptr))
192 {
193 g_EntList = servertools->GetEntityList();
194 }
195#endif
196
197 char *addr = NULL;
198
199 /*
200 * gEntList and/or g_pEntityList
201 *
202 * First try to lookup pointer directly for platforms with symbols.
203 * If symbols aren't present (Windows or stripped Linux/Mac),
204 * attempt find via LevelShutdown + offset
205 */
206 if (!g_EntList)
207 {
208 if (g_pGameConf->GetMemSig("gEntList", (void **) &addr))
209 {
210#if !defined PLATFORM_WINDOWS
211 if (!addr)
212 {
213 // Key exists so notify if lookup fails, but try other method.
214 logger->LogError("Failed lookup of gEntList directly - Reverting to lookup via LevelShutdown");
215 }
216 else
217 {
218#endif
219 g_EntList = reinterpret_cast<void *>(addr);
220#if !defined PLATFORM_WINDOWS
221 }
222#endif
223 }
224 }
225
226 if (!g_EntList)
227 {
228 if (g_pGameConf->GetMemSig("LevelShutdown", (void **) &addr) && addr)
229 {
230 int offset;
231 if (!g_pGameConf->GetOffset("gEntList", &offset))
232 {
233 logger->LogError("Logical Entities not supported by this mod (gEntList) - Reverting to networkable entities only");
234 return;
235 }
236

Callers

nothing calls this directly

Calls 4

GetMemSigMethod · 0.45
LogErrorMethod · 0.45
GetOffsetMethod · 0.45
GetAddressMethod · 0.45

Tested by

no test coverage detected