From 61ea1d4429e0ddd7ac564c35233f637c5da4f3aa Mon Sep 17 00:00:00 2001 From: TimeServ Date: Wed, 30 Nov 2005 05:01:43 +0000 Subject: [PATCH] plug_list enhancement git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1637 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/common/plugin.c | 20 +++++++++++++++++++- engine/common/qvm.c | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/engine/common/plugin.c b/engine/common/plugin.c index 6c6c7b671..bf11f3692 100644 --- a/engine/common/plugin.c +++ b/engine/common/plugin.c @@ -28,6 +28,8 @@ typedef struct plugin_s { //protocol-in-a-plugin int connectionlessclientpacket; + int messagefunction; + struct plugin_s *next; } plugin_t; @@ -261,6 +263,8 @@ int VARGS Plug_ExportToEngine(void *offset, unsigned int mask, const long *arg) currentplug->sbarlevel[2] = arg[1]; else if (!strcmp(name, "ConnectionlessClientPacket")) currentplug->connectionlessclientpacket = arg[1]; + else if (!strcmp(name, "MessageEvent")) + currentplug->messagefunction = arg[1]; else return 0; return 1; @@ -1502,6 +1506,19 @@ void Plug_SBar(void) currentplug = oc; } +int Plug_Message(int clientnum, int messagelevel, char *buffer) +{ + for (currentplug = plugs; currentplug; currentplug = currentplug->next) + { + if (currentplug->messagefunction) + { + VM_Call(currentplug->vm, currentplug->messagefunction, clientnum, messagelevel, buffer); + } + } + + return 1; // don't silence message +} + void Plug_Close(plugin_t *plug) { if (plugs == plug) @@ -1585,7 +1602,8 @@ void Plug_List_f(void) plugin_t *plug; for (plug = plugs; plug; plug = plug->next) { - Con_Printf("%s\n", plug->name); + Con_Printf("%s - \n", plug->name); + VM_PrintInfo(plug->vm); } } diff --git a/engine/common/qvm.c b/engine/common/qvm.c index 21af74b2d..46285642d 100644 --- a/engine/common/qvm.c +++ b/engine/common/qvm.c @@ -947,7 +947,7 @@ void VM_PrintInfo(vm_t *vm) qvm_t *qvm; if(!vm->name[0]) return; - Con_Printf("%s: ", vm->name); + Con_Printf("%s (%i): ", vm->name, (int)vm->hInst); switch(vm->type) {