aboutsummaryrefslogtreecommitdiff
path: root/src/engineapi.c
diff options
context:
space:
mode:
authorGravatar Michael Smith <mikesmiffy128@gmail.com> 2025-04-17 01:39:10 +0100
committerGravatar Michael Smith <mikesmiffy128@gmail.com> 2025-04-17 20:02:18 +0100
commit8a669bc96ffdb9d0f6f54e464da11e3375c80a55 (patch)
tree569dac0cd082ad25e779a69f0bcceff5ca212bb1 /src/engineapi.c
parent0b40d4d9ea1cbfbb92795e0d6f26cf108f2dec5f (diff)
downloadsst-8a669bc96ffdb9d0f6f54e464da11e3375c80a55.tar.gz
sst-8a669bc96ffdb9d0f6f54e464da11e3375c80a55.zip
Add type-safety to virtual calls and accessors
This probably should have been the design from the start. It's still possible to use void pointers, and this is done in a couple of places for simplicity, but wherever possible, we have actual structs for things now. Additionally, in places where vtables are fiddled with, e.g. vtable hooks, we have actual struct definitions with vtable pointers so there's need for pointer-casting horror.
Diffstat (limited to 'src/engineapi.c')
-rw-r--r--src/engineapi.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/engineapi.c b/src/engineapi.c
index 54a6d8f..44713da 100644
--- a/src/engineapi.c
+++ b/src/engineapi.c
@@ -40,15 +40,16 @@ ifacefactory factory_client = 0, factory_server = 0, factory_engine = 0,
struct VEngineClient *engclient;
struct VEngineServer *engserver;
-void *srvdll;
+struct IServerGameDLL *srvdll;
-DECL_VFUNC(void *, GetGlobalVars, 1) // seems to be very stable, thank goodness
-void *globalvars;
+DECL_VFUNC(void, struct CGlobalVars *, GetGlobalVars, 1) // seems very stable
+struct CGlobalVars *globalvars;
-void *inputsystem, *vgui;
+struct IInputSystem *inputsystem;
+struct CEngineVGui *vgui;
struct CServerPlugin *pluginhandler;
-DECL_VFUNC_DYN(void *, GetAllServerClasses)
+DECL_VFUNC_DYN(struct IServerGameDLL, struct ServerClass *, GetAllServerClasses)
#include <entpropsinit.gen.h> // generated by build/mkentprops.c
#include <gamedatainit.gen.h> // generated by build/mkgamedata.c