From 84b518298c32f79ef5d4f056d6d8e8c251417b8a Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 6 Jun 2025 21:31:44 +0100 Subject: Improve the plugin_load/plugin_unload hooks Most notably, don't just silently return when no parameter is provided; allow the default handler to print the usual error message. Also, don't raise the PluginLoaded/PluginUnloaded events when nothing has actually happened. And rearrange the v1/v2 union so we don't need to spell out `v2.common`. Error message issue pointed out by Evan Lin - thanks! --- src/engineapi.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/engineapi.h') diff --git a/src/engineapi.h b/src/engineapi.h index ef716a9..4118a3c 100644 --- a/src/engineapi.h +++ b/src/engineapi.h @@ -23,7 +23,6 @@ #define INC_ENGINEAPI_H #include "intdefs.h" -#include "vcall.h" /* * Here, we define a bunch of random data types as well as interfaces that don't @@ -128,7 +127,7 @@ extern struct CGlobalVars *globalvars; extern struct IInputSystem *inputsystem; extern struct CEngineVGui *vgui; -// XXX: not exactly engine *API* but not curently clear where else to put this +// XXX: not exactly engine *API* but not currently clear where else to put this struct CPlugin_common { bool paused; void *theplugin; // our own "this" pointer (or whichever other plugin it is) @@ -143,8 +142,8 @@ struct CPlugin { struct CPlugin_common v1; struct { char basename[128]; // WHY VALVE WHYYYYYYY!!!! - struct CPlugin_common common; - } v2; + struct CPlugin_common v2; + }; }; }; struct CServerPlugin /* : IServerPluginHelpers */ { -- cgit v1.2.3-54-g00ecf