1
0
Fork 0
forked from fte/fteqw

Stop some plugins from failing/crashing.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5670 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2020-04-19 03:50:14 +00:00
parent 81617eaebc
commit 50c4e75c65
3 changed files with 14 additions and 7 deletions

View file

@ -1788,7 +1788,7 @@ static bool World_Bullet_DoInit(void)
if (!rbefuncs || !rbefuncs->RegisterPhysicsEngine) if (!rbefuncs || !rbefuncs->RegisterPhysicsEngine)
{ {
rbefuncs = nullptr; rbefuncs = nullptr;
Con_Printf("Bullet plugin failed: Engine doesn't support physics engine plugins.\n"); Con_Printf("Bullet plugin failed: Engine is incompatible.\n");
} }
else if (!rbefuncs->RegisterPhysicsEngine("Bullet", World_Bullet_Start)) else if (!rbefuncs->RegisterPhysicsEngine("Bullet", World_Bullet_Start))
Con_Printf("Bullet plugin failed: Engine already has a physics plugin active.\n"); Con_Printf("Bullet plugin failed: Engine already has a physics plugin active.\n");
@ -1803,7 +1803,8 @@ static bool World_Bullet_DoInit(void)
extern "C" qboolean Plug_Init(void) extern "C" qboolean Plug_Init(void)
{ {
rbefuncs = (rbeplugfuncs_t*)plugfuncs->GetEngineInterface("RBE", sizeof(*rbefuncs)); rbefuncs = (rbeplugfuncs_t*)plugfuncs->GetEngineInterface("RBE", sizeof(*rbefuncs));
if (rbefuncs && rbefuncs->version < RBEPLUGFUNCS_VERSION) if (rbefuncs && ( rbefuncs->version < RBEPLUGFUNCS_VERSION ||
rbefuncs->wedictsize != sizeof(wedict_t)))
rbefuncs = nullptr; rbefuncs = nullptr;
plugfuncs->ExportFunction("Shutdown", (funcptr_t)World_Bullet_Shutdown); plugfuncs->ExportFunction("Shutdown", (funcptr_t)World_Bullet_Shutdown);

View file

@ -904,7 +904,14 @@ qboolean Plug_Init(void)
{ {
jclient_needreadconfig = true; jclient_needreadconfig = true;
if (plugfuncs->ExportFunction("Tick", JCL_Frame) && confuncs = (plugsubconsolefuncs_t*)plugfuncs->GetEngineInterface(plugsubconsolefuncs_name, sizeof(*confuncs));
drawfuncs = (plug2dfuncs_t*)plugfuncs->GetEngineInterface(plug2dfuncs_name, sizeof(*drawfuncs));
netfuncs = (plugnetfuncs_t*)plugfuncs->GetEngineInterface(plugnetfuncs_name, sizeof(*netfuncs));
filefuncs = (plugfsfuncs_t*)plugfuncs->GetEngineInterface(plugfsfuncs_name, sizeof(*filefuncs));
clientfuncs = (plugclientfuncs_t*)plugfuncs->GetEngineInterface(plugclientfuncs_name, sizeof(*clientfuncs));
if (netfuncs && filefuncs &&
plugfuncs->ExportFunction("Tick", JCL_Frame) &&
plugfuncs->ExportFunction("Shutdown", JCL_Shutdown) && plugfuncs->ExportFunction("Shutdown", JCL_Shutdown) &&
plugfuncs->ExportFunction("ExecuteCommand", JCL_ExecuteCommand)) plugfuncs->ExportFunction("ExecuteCommand", JCL_ExecuteCommand))
{ {
@ -912,9 +919,10 @@ qboolean Plug_Init(void)
plugfuncs->ExportFunction("UpdateVideo", JCL_UpdateVideo); plugfuncs->ExportFunction("UpdateVideo", JCL_UpdateVideo);
plugfuncs->ExportFunction("ConsoleLink", JCL_ConsoleLink); plugfuncs->ExportFunction("ConsoleLink", JCL_ConsoleLink);
plugfuncs->ExportFunction("ConsoleLinkMouseOver", JCL_ConsoleLinkMouseOver); if (drawfuncs)
plugfuncs->ExportFunction("ConsoleLinkMouseOver", JCL_ConsoleLinkMouseOver);
if (!plugfuncs->ExportFunction("ConExecuteCommand", JCL_ConExecuteCommand)) if (!confuncs || !plugfuncs->ExportFunction("ConExecuteCommand", JCL_ConExecuteCommand))
{ {
Con_Printf("XMPP plugin in single-console mode\n"); Con_Printf("XMPP plugin in single-console mode\n");
Con_TrySubPrint = Fallback_ConPrint; Con_TrySubPrint = Fallback_ConPrint;

View file

@ -663,8 +663,6 @@ static int QDECL QI_ConExecuteCommand(qboolean isinsecure)
static qboolean QI_ExecuteCommand(qboolean isinsecure) static qboolean QI_ExecuteCommand(qboolean isinsecure)
{ {
char cmd[256]; char cmd[256];
if (isinsecure)
return false;
cmdfuncs->Argv(0, cmd, sizeof(cmd)); cmdfuncs->Argv(0, cmd, sizeof(cmd));
if (!strcmp(cmd, "qi") || !strcmp(cmd, "quaddicted")) if (!strcmp(cmd, "qi") || !strcmp(cmd, "quaddicted"))
{ {