summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/sample.c10
-rwxr-xr-xtools/HPMHookGen/HPMHookGen.pl30
2 files changed, 22 insertions, 18 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;
diff --git a/tools/HPMHookGen/HPMHookGen.pl b/tools/HPMHookGen/HPMHookGen.pl
index 201a82bf8..c357d0dbd 100755
--- a/tools/HPMHookGen/HPMHookGen.pl
+++ b/tools/HPMHookGen/HPMHookGen.pl
@@ -194,16 +194,18 @@ sub parse($$) {
$indirectionlvl++ if ($array); # Arrays are pointer, no matter how cute you write them
push(@args, {
- var => $var,
- callvar => $callvar,
- type => $type1.$array.$type2,
- orig => $type1 eq '...' ? '...' : trim("$type1 $indir$var$array $type2"),
- indir => $indirectionlvl,
- hookf => $type1 eq '...' ? "va_list ${var}" : trim("$type1 $dereference$indir$var$array $type2"),
- hookc => trim("$addressof$callvar"),
- origc => trim($callvar),
- pre => $pre_code,
- post => $post_code,
+ var => $var,
+ callvar => $callvar,
+ type => $type1.$array.$type2,
+ orig => $type1 eq '...' ? '...' : trim("$type1 $indir$var$array $type2"),
+ indir => $indirectionlvl,
+ hookpref => $type1 eq '...' ? "va_list ${var}" : trim("$type1 $dereference$indir$var$array $type2"),
+ hookpostf => $type1 eq '...' ? "va_list ${var}" : trim("$type1 $indir$var$array $type2"),
+ hookprec => trim("$addressof$callvar"),
+ hookpostc => trim("$callvar"),
+ origc => trim($callvar),
+ pre => $pre_code,
+ post => $post_code,
});
$lastvar = $var;
}
@@ -416,10 +418,10 @@ foreach my $file (@files) { # Loop through the xml files
$if->{postcall} .= ', ';
}
$if->{handlerdef} .= $arg->{orig};
- $if->{predef} .= $arg->{hookf};
- $if->{precall} .= $arg->{hookc};
- $if->{postdef} .= $arg->{hookf};
- $if->{postcall} .= $arg->{hookc};
+ $if->{predef} .= $arg->{hookpref};
+ $if->{precall} .= $arg->{hookprec};
+ $if->{postdef} .= $arg->{hookpostf};
+ $if->{postcall} .= $arg->{hookpostc};
$if->{origcall} .= $arg->{origc};
$i++; $j++;
}