summaryrefslogtreecommitdiff
path: root/src/plugins/sample.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-02-28 02:17:21 +0100
committerHaru <haru@dotalux.com>2016-04-30 15:57:46 +0200
commit5db7c799055c6ae9c4463f6cf4c88a35597d5d31 (patch)
treee3cdf52436dc322aaab69babc6021af911bf7b9e /src/plugins/sample.c
parent1ec93281b66061f7f7cff509450299bdcbf813b4 (diff)
downloadhercules-5db7c799055c6ae9c4463f6cf4c88a35597d5d31.tar.gz
hercules-5db7c799055c6ae9c4463f6cf4c88a35597d5d31.tar.bz2
hercules-5db7c799055c6ae9c4463f6cf4c88a35597d5d31.tar.xz
hercules-5db7c799055c6ae9c4463f6cf4c88a35597d5d31.zip
Added type-checking for the addHookPre() and addHookPost() macros
- The macros will now throw a warning at compile time if a plugin is using a wrong function type for a pre or post hook. This avoids some very subtle, hard to detect, issues. - The macros now require 3 arguments instead of 2. Example: old code: addHookPre("ifname->function" my_hook); becomes: addHookPre(ifname, function, my_hook); Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/plugins/sample.c')
-rw-r--r--src/plugins/sample.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/sample.c b/src/plugins/sample.c
index d6036dd70..1e45f9afd 100644
--- a/src/plugins/sample.c
+++ b/src/plugins/sample.c
@@ -200,13 +200,13 @@ HPExport void plugin_init (void) {
/* in this sample we add a PreHook to pc->dropitem */
/* to identify whether the item being dropped is on amount higher than 1 */
/* if so, it stores the amount on a variable (my_pc_dropitem_storage) and changes the amount to 1 */
- addHookPre("pc->dropitem",my_pc_dropitem_pre);
+ addHookPre(pc, dropitem, my_pc_dropitem_pre);
/* in this sample we add a PostHook to pc->dropitem */
/* if the original pc->dropitem was successful and the amount stored on my_pc_dropitem_storage is higher than 1, */
/* our posthook will display a message to the user about the cap */
/* - by checking whether it was successful (retVal value) it allows for the originals conditions to take place */
- addHookPost("pc->dropitem",my_pc_dropitem_post);
+ addHookPost(pc, dropitem, my_pc_dropitem_post);
}
}
/* triggered when server starts loading, before any server-specific data is set */