From 464c9398ae49d8faae46f81fb7040155408858f7 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Wed, 30 Aug 2023 23:18:38 +0100 Subject: Perform very minor load/unload optimisations Because why not. --- src/engineapi.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/engineapi.c') diff --git a/src/engineapi.c b/src/engineapi.c index 24a2d6b..6cb67d2 100644 --- a/src/engineapi.c +++ b/src/engineapi.c @@ -47,6 +47,8 @@ DECL_VFUNC_DYN(void *, GetAllServerClasses) #include // generated by build/mkentprops.c +static void *srvdll; + bool engineapi_init(int pluginver) { if (!con_detect(pluginver)) return false; pluginhandler = factory_engine("ISERVERPLUGINHELPERS001", 0); @@ -75,7 +77,6 @@ bool engineapi_init(int pluginver) { vgui = factory_engine("VEngineVGui001", 0); - void *srvdll; // TODO(compat): add this back when there's gamedata for 009 (no point atm) /*if (srvdll = factory_engine("ServerGameDLL009", 0)) { _gametype_tag |= _gametype_tag_SrvDLL009; @@ -104,11 +105,18 @@ bool engineapi_init(int pluginver) { gamedata_init(); con_init(); if (!gameinfo_init()) { con_disconnect(); return false; } - if (has_vtidx_GetAllServerClasses && has_sz_SendProp && + return true; +} + +void engineapi_lateinit(void) { + // from AM L4D2 SDK headers: + // > SENDPROP_VECTORELEM makes [the offset] negative to start with so we + // > can detect that and set the SPROP_IS_VECTOR_ELEM flag. + // by doing this at the deferred stage, we avoid having to abs() everything + if (srvdll && has_vtidx_GetAllServerClasses && has_sz_SendProp && has_off_SP_varname && has_off_SP_offset) { initentprops(GetAllServerClasses(srvdll)); } - return true; } // vi: sw=4 ts=4 noet tw=80 cc=80 -- cgit v1.2.3