summaryrefslogtreecommitdiff
path: root/src/map/map.c
diff options
context:
space:
mode:
authorInkfish <Inkfish@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-10-25 09:38:33 +0000
committerInkfish <Inkfish@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-10-25 09:38:33 +0000
commit7da9ee0b5c0aad9425441bcddeeadb745aa4c0d5 (patch)
tree7207e15b81b7816156384b8f040ee5dda17de86a /src/map/map.c
parent9b4d9f29a8ab56f59cbac2cccbb685146f52faac (diff)
downloadhercules-7da9ee0b5c0aad9425441bcddeeadb745aa4c0d5.tar.gz
hercules-7da9ee0b5c0aad9425441bcddeeadb745aa4c0d5.tar.bz2
hercules-7da9ee0b5c0aad9425441bcddeeadb745aa4c0d5.tar.xz
hercules-7da9ee0b5c0aad9425441bcddeeadb745aa4c0d5.zip
* 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
Diffstat (limited to 'src/map/map.c')
-rw-r--r--src/map/map.c8
1 files changed, 5 insertions, 3 deletions
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;
}