From 547dd68d284f021819be41f44821f2785edfa9f9 Mon Sep 17 00:00:00 2001 From: Haru Date: Mon, 21 Sep 2015 15:55:28 +0200 Subject: Corrected a VisualStudio compile issue. - Follow-up to ba9c1cc1 - Fixes #726 Signed-off-by: Haru --- src/map/atcommand.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src/map') 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; } -- cgit v1.2.3-60-g2f50