diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-09-24 15:32:41 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-09-24 15:33:09 +0300 |
commit | 7a867315dac6aaf78a4d61ea67174820a4d30c59 (patch) | |
tree | d08ace6759528a25ed9e124724309e4d0832dc1b /src/map/map.c | |
parent | f94190251bc199582d819fefa448b32a662a297a (diff) | |
download | hercules-7a867315dac6aaf78a4d61ea67174820a4d30c59.tar.gz hercules-7a867315dac6aaf78a4d61ea67174820a4d30c59.tar.bz2 hercules-7a867315dac6aaf78a4d61ea67174820a4d30c59.tar.xz hercules-7a867315dac6aaf78a4d61ea67174820a4d30c59.zip |
Add bl parameter to closest_freecell.
Diffstat (limited to 'src/map/map.c')
-rw-r--r-- | src/map/map.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/map/map.c b/src/map/map.c index cd0f516ed..ddb5ace42 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1511,7 +1511,7 @@ int map_search_freecell(struct block_list *src, int16 m, int16 *x,int16 *y, int1 * flag: * 0x1 - only count standing units *------------------------------------------*/ -bool map_closest_freecell(int16 m, int16 *x, int16 *y, int type, int flag) +bool map_closest_freecell(int16 m, const struct block_list *bl, int16 *x, int16 *y, int type, int flag) { uint8 dir = 6; int16 tx = *x; @@ -1530,7 +1530,7 @@ bool map_closest_freecell(int16 m, int16 *x, int16 *y, int type, int flag) if(dir%2 == 0 && costrange%MOVE_COST == 0) { tx = *x+dx*(costrange/MOVE_COST); ty = *y+dy*(costrange/MOVE_COST); - if (!map->count_oncell(m, tx, ty, type, flag) && map->getcell(m, NULL, tx, ty, CELL_CHKPASS)) { + if (!map->count_oncell(m, tx, ty, type, flag) && map->getcell(m, bl, tx, ty, CELL_CHKPASS)) { *x = tx; *y = ty; return true; @@ -1540,7 +1540,7 @@ bool map_closest_freecell(int16 m, int16 *x, int16 *y, int type, int flag) else if(dir%2 == 1 && costrange%MOVE_DIAGONAL_COST == 0) { tx = *x+dx*(costrange/MOVE_DIAGONAL_COST); ty = *y+dy*(costrange/MOVE_DIAGONAL_COST); - if (!map->count_oncell(m, tx, ty, type, flag) && map->getcell(m, NULL, tx, ty, CELL_CHKPASS)) { + if (!map->count_oncell(m, tx, ty, type, flag) && map->getcell(m, bl, tx, ty, CELL_CHKPASS)) { *x = tx; *y = ty; return true; @@ -1550,14 +1550,14 @@ bool map_closest_freecell(int16 m, int16 *x, int16 *y, int type, int flag) else if(dir%2 == 1 && costrange%MOVE_COST == 4) { tx = *x+dx*((dir%4==3)?(costrange/MOVE_COST):1); ty = *y+dy*((dir%4==1)?(costrange/MOVE_COST):1); - if (!map->count_oncell(m, tx, ty, type, flag) && map->getcell(m, NULL, tx, ty, CELL_CHKPASS)) { + if (!map->count_oncell(m, tx, ty, type, flag) && map->getcell(m, bl, tx, ty, CELL_CHKPASS)) { *x = tx; *y = ty; return true; } tx = *x+dx*((dir%4==1)?(costrange/MOVE_COST):1); ty = *y+dy*((dir%4==3)?(costrange/MOVE_COST):1); - if (!map->count_oncell(m, tx, ty, type, flag) && map->getcell(m, NULL, tx, ty, CELL_CHKPASS)) { + if (!map->count_oncell(m, tx, ty, type, flag) && map->getcell(m, bl, tx, ty, CELL_CHKPASS)) { *x = tx; *y = ty; return true; |