summaryrefslogtreecommitdiffhomepage
path: root/src/engineapi.c
diff options
context:
space:
mode:
authorMichael Smith <mikesmiffy128@gmail.com>2023-08-30 23:18:38 +0100
committerMichael Smith <mikesmiffy128@gmail.com>2023-08-30 23:44:50 +0100
commit464c9398ae49d8faae46f81fb7040155408858f7 (patch)
tree3c8f035e752124a7f9f32179fa01d5c56c9d2439 /src/engineapi.c
parent8a1c4de9b33128c10378f1938d8a60c071f01ad0 (diff)
Perform very minor load/unload optimisations
Because why not.
Diffstat (limited to 'src/engineapi.c')
-rw-r--r--src/engineapi.c14
1 files changed, 11 insertions, 3 deletions
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 <entpropsinit.gen.h> // 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