summaryrefslogtreecommitdiff
path: root/src/map/map.c
diff options
context:
space:
mode:
authorgumi <git@gumi.ca>2018-11-07 16:14:36 -0500
committergumi <git@gumi.ca>2018-11-07 16:15:26 -0500
commitf3af2d37a90a83bbec25c15e59c29e0f9802daca (patch)
treead869c6a1ed701fe4e42961ec572cfd5b12e63a9 /src/map/map.c
parentb30f62468a5e923bf5d9533adec064ada1716459 (diff)
downloadhercules-f3af2d37a90a83bbec25c15e59c29e0f9802daca.tar.gz
hercules-f3af2d37a90a83bbec25c15e59c29e0f9802daca.tar.bz2
hercules-f3af2d37a90a83bbec25c15e59c29e0f9802daca.tar.xz
hercules-f3af2d37a90a83bbec25c15e59c29e0f9802daca.zip
break the loop in buildin_getunits when the max is reached
Diffstat (limited to 'src/map/map.c')
-rw-r--r--src/map/map.c13
1 files changed, 13 insertions, 0 deletions
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;