From f3af2d37a90a83bbec25c15e59c29e0f9802daca Mon Sep 17 00:00:00 2001 From: gumi Date: Wed, 7 Nov 2018 16:14:36 -0500 Subject: break the loop in buildin_getunits when the max is reached --- src/map/map.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/map/map.c') diff --git a/src/map/map.c b/src/map/map.c index ce8f4cdf5..d59223477 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -635,6 +635,18 @@ static int map_foreachinmap(int (*func)(struct block_list*, va_list), int16 m, i return returnCount; } +static int map_forcountinmap(int (*func)(struct block_list*, va_list), int16 m, int count, int type, ...) +{ + int returnCount; + va_list ap; + + va_start(ap, type); + returnCount = map->vforcountinarea(func, m, 0, 0, map->list[m].bxs, map->list[m].bys, count, type, ap); + va_end(ap); + + return returnCount; +} + /** * Applies func to every block_list object of bl_type type on all maps * of instance instance_id. @@ -6873,6 +6885,7 @@ void map_defaults(void) map->foreachinpath = map_foreachinpath; map->vforeachinmap = map_vforeachinmap; map->foreachinmap = map_foreachinmap; + map->forcountinmap = map_forcountinmap; map->vforeachininstance = map_vforeachininstance; map->foreachininstance = map_foreachininstance; -- cgit v1.2.3-60-g2f50