From 7da9ee0b5c0aad9425441bcddeeadb745aa4c0d5 Mon Sep 17 00:00:00 2001 From: Inkfish Date: Sun, 25 Oct 2009 09:38:33 +0000 Subject: * Implemented the official version of 'OnTouch' named as 'OnTouch_'.(it can be defined in script_athena.conf) * Adapted 'map_foreachinarea' to 'map_forsomeinarea' so that it allows you to specify the number of bl you wanna operate on. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14097 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/map.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/map/map.c') diff --git a/src/map/map.c b/src/map/map.c index 1215246b1..ed706bcdb 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -650,7 +650,7 @@ int map_foreachinshootrange(int (*func)(struct block_list*,va_list),struct block * funcを呼ぶ * type!=0 ならその種類のみ *------------------------------------------*/ -int map_foreachinarea(int (*func)(struct block_list*,va_list), int m, int x0, int y0, int x1, int y1, int type, ...) +int map_forsomeinarea(int (*func)(struct block_list*,va_list), int m, int x0, int y0, int x1, int y1, int count, int type, ...) { int bx,by; int returnCount =0; //total sum of returned values of func() [Skotlex] @@ -702,6 +702,8 @@ int map_foreachinarea(int (*func)(struct block_list*,va_list), int m, int x0, in va_start(ap, type); returnCount += func(bl_list[i], ap); va_end(ap); + if( count && returnCount >= count) + break; } map_freeblock_unlock(); // 解放を許可する @@ -1295,9 +1297,9 @@ int map_search_freecell(struct block_list *src, int m, short *x,short *y, int rx if(flag&4) { if (spawn >= 100) return 0; //Limit of retries reached. if (spawn++ < battle_config.no_spawn_on_player && - map_foreachinarea(map_count_sub, m, + map_forsomeinarea(map_count_sub, m, *x-AREA_SIZE, *y-AREA_SIZE, - *x+AREA_SIZE, *y+AREA_SIZE, BL_PC) + *x+AREA_SIZE, *y+AREA_SIZE, 0, BL_PC) ) continue; } -- cgit v1.2.3-60-g2f50