diff options
author | Haru <haru@dotalux.com> | 2016-04-15 19:37:54 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2016-04-30 15:57:48 +0200 |
commit | 8aacecc4bf47b40df0f78ef1ef58b2896bbbf299 (patch) | |
tree | af3e7149c57879564d26f1cd26c2d0a0d4c2385f /src | |
parent | fa2f2f4f2cba8cfb2d6d950c69d7c4348ba66205 (diff) | |
download | hercules-8aacecc4bf47b40df0f78ef1ef58b2896bbbf299.tar.gz hercules-8aacecc4bf47b40df0f78ef1ef58b2896bbbf299.tar.bz2 hercules-8aacecc4bf47b40df0f78ef1ef58b2896bbbf299.tar.xz hercules-8aacecc4bf47b40df0f78ef1ef58b2896bbbf299.zip |
Removed extra indirection level in HPMHooking post-hooks
- The extra indirection level (necessary to override function arguments
from a hook) isn't necessary in post-hooks, but only in pre-hooks.
- This simplifies the syntax and code of post-hooks.
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/sample.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/sample.c b/src/plugins/sample.c index 1e45f9afd..991e03e4c 100644 --- a/src/plugins/sample.c +++ b/src/plugins/sample.c @@ -123,11 +123,13 @@ int my_pc_dropitem_pre(struct map_session_data *sd,int *n,int *amount) { return 0; } /* postHook receive retVal as the first param, allows posthook to act accordingly to whatever the original was going to return */ -int my_pc_dropitem_post(int retVal, struct map_session_data *sd,int *n,int *amount) { - if( retVal != 1 ) return retVal;/* we don't do anything if pc_dropitem didn't return 1 (success) */ - if( my_pc_dropitem_storage ) {/* signs whether pre-hook did this */ +int my_pc_dropitem_post(int retVal, struct map_session_data *sd, int n, int amount) +{ + if (retVal != 1) + return retVal;/* we don't do anything if pc_dropitem didn't return 1 (success) */ + if (my_pc_dropitem_storage) {/* signs whether pre-hook did this */ char output[99]; - safesnprintf(output,99,"[ Warning ] you can only drop 1 item at a time, capped from %d to 1",my_pc_dropitem_storage); + safesnprintf(output, 99, "[ Warning ] you can only drop 1 item at a time, capped from %d to 1", my_pc_dropitem_storage); clif->messagecolor_self(sd->fd, COLOR_RED, output); } return 1; |