summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-09-21 15:55:28 +0200
committerHaru <haru@dotalux.com>2015-09-21 15:55:28 +0200
commit547dd68d284f021819be41f44821f2785edfa9f9 (patch)
tree8fe83cfa557a58d5b77e1d98a467c48f94a0ec53 /src/map/atcommand.c
parent09d93aa3339cb16a29dc916af0a200617e704099 (diff)
downloadhercules-547dd68d284f021819be41f44821f2785edfa9f9.tar.gz
hercules-547dd68d284f021819be41f44821f2785edfa9f9.tar.bz2
hercules-547dd68d284f021819be41f44821f2785edfa9f9.tar.xz
hercules-547dd68d284f021819be41f44821f2785edfa9f9.zip
Corrected a VisualStudio compile issue.
- Follow-up to ba9c1cc1 - Fixes #726 Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index f01311235..fbd010e74 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -1524,15 +1524,24 @@ ACMD(help) {
return true;
}
-// helper function, used in foreach calls to stop auto-attack timers
-// parameter: '0' - everyone, 'id' - only those attacking someone with that id
+/**
+ * Helper function, used in foreach calls to stop auto-attack timers.
+ *
+ * @see map_foreachinmap
+ *
+ * Arglist parameters:
+ * - (int) id: If 0, stop any attacks. Otherwise, the target block list id to stop attacking.
+ */
int atcommand_stopattack(struct block_list *bl,va_list ap)
{
- struct unit_data *ud = unit->bl2ud(bl);
+ struct unit_data *ud = NULL;
+ int id = 0;
nullpo_ret(bl);
- int id = va_arg(ap, int);
- if (ud && ud->attacktimer != INVALID_TIMER && (!id || id == ud->target))
- {
+
+ ud = unit->bl2ud(bl);
+ id = va_arg(ap, int);
+
+ if (ud && ud->attacktimer != INVALID_TIMER && (!id || id == ud->target)) {
unit->stop_attack(bl);
return 1;
}