From a724476174cd691704a51f60e540513bae743432 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Fri, 22 Nov 2013 10:47:45 -0200 Subject: Minor HPMi Sub Modifications - HPMi->addCommand is now addAtcommand, dropped usage of ACMD_A() - HPMi->addScript is now addScriptCommand, dropped usage of BUILDIN_A() - HPMi->addCPCommand is now addCPCommand, dropped necessity of CPCMD_A() - HPMi->addPacket is now addPacket, 5th param (HPMi->pid) is now automatically filled by the macro, therefore param count drops to 4 (packetID,packetLength,packetFunction,packetIncomingPoint). There is no longer necessity to check for the availability of the commands, the macros will do it on their own and drop a warning about it upon failure. These changes won't affect pre-compiled plugins. Signed-off-by: shennetsind --- src/common/HPMi.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/common/HPMi.h') diff --git a/src/common/HPMi.h b/src/common/HPMi.h index 7637dc832..2cd1075c4 100644 --- a/src/common/HPMi.h +++ b/src/common/HPMi.h @@ -105,6 +105,30 @@ enum HPluginDataTypes { #define getFromNPCD(ptr,index) (HPMi->getFromHPData(HPDT_NPCD,HPMi->pid,(ptr),(index))) #define removeFromNPCD(ptr,index) (HPMi->removeFromHPData(HPDT_NPCD,HPMi->pid,(ptr),(index))) +/* HPMi->addCommand */ +#define addAtcommand(cname,funcname) \ + if ( HPMi->addCommand != NULL ) { \ + HPMi->addCommand(cname,atcommand_ ## funcname); \ + } else { \ + ShowWarning("HPM (%s):addAtcommand(\"%s\",%s) failed, addCommand sub is NULL!\n",pinfo.name,cname,# funcname);\ + } +/* HPMi->addScript */ +#define addScriptCommand(cname,scinfo,funcname) \ + if ( HPMi->addScript != NULL ) { \ + HPMi->addScript(cname,scinfo,buildin_ ## funcname); \ + } else { \ + ShowWarning("HPM (%s):addScriptCommand(\"%s\",\"%s\",%s) failed, addScript sub is NULL!\n",pinfo.name,cname,scinfo,# funcname);\ + } +/* HPMi->addCPCommand */ +#define addCPCommand(cname,funcname) \ + if ( HPMi->addCPCommand != NULL ) { \ + HPMi->addCPCommand(cname,console_parse_ ## funcname); \ + } else { \ + ShowWarning("HPM (%s):addCPCommand(\"%s\",%s) failed, addCPCommand sub is NULL!\n",pinfo.name,cname,# funcname);\ + } +/* HPMi->addPacket */ +#define addPacket(cmd,len,receive,point) HPMi->addPacket(cmd,len,receive,point,HPMi->pid) + /* Hercules Plugin Mananger Include Interface */ HPExport struct HPMi_interface { /* */ -- cgit v1.2.3-60-g2f50