summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-09-24 14:33:37 +0300
committerAndrei Karas <akaras@inbox.ru>2015-09-24 15:27:07 +0300
commitf94190251bc199582d819fefa448b32a662a297a (patch)
tree9da8729c5c2e7a20a5a355d520872897b5f7f9e2 /src/map
parent6b135d6fbda3e033712ab2a5dafe0c97f536cf3c (diff)
downloadhercules-f94190251bc199582d819fefa448b32a662a297a.tar.gz
hercules-f94190251bc199582d819fefa448b32a662a297a.tar.bz2
hercules-f94190251bc199582d819fefa448b32a662a297a.tar.xz
hercules-f94190251bc199582d819fefa448b32a662a297a.zip
Add bl parameter to getcell functions.
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c16
-rw-r--r--src/map/battle.c2
-rw-r--r--src/map/buyingstore.c4
-rw-r--r--src/map/chat.c2
-rw-r--r--src/map/clif.c4
-rw-r--r--src/map/map.c39
-rw-r--r--src/map/map.h8
-rw-r--r--src/map/mob.c6
-rw-r--r--src/map/npc.c16
-rw-r--r--src/map/path.c26
-rw-r--r--src/map/pc.c6
-rw-r--r--src/map/pet.c2
-rw-r--r--src/map/script.c5
-rw-r--r--src/map/skill.c40
-rw-r--r--src/map/status.c4
-rw-r--r--src/map/unit.c36
16 files changed, 109 insertions, 107 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index fbd010e74..4e4cd8aa7 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -458,7 +458,7 @@ ACMD(mapmove) {
return false;
}
- if ((x || y) && map->getcell(m, x, y, CELL_CHKNOPASS) && pc_get_group_level(sd) < battle_config.gm_ignore_warpable_area) {
+ if ((x || y) && map->getcell(m, &sd->bl, x, y, CELL_CHKNOPASS) && pc_get_group_level(sd) < battle_config.gm_ignore_warpable_area) {
//This is to prevent the pc->setpos call from printing an error.
clif->message(fd, msg_fd(fd,2));
if (!map->search_freecell(NULL, m, &x, &y, 10, 10, 1))
@@ -573,7 +573,7 @@ ACMD(jump)
return false;
}
- if ((x || y) && map->getcell(sd->bl.m, x, y, CELL_CHKNOPASS)) {
+ if ((x || y) && map->getcell(sd->bl.m, &sd->bl, x, y, CELL_CHKNOPASS)) {
//This is to prevent the pc->setpos call from printing an error.
clif->message(fd, msg_fd(fd,2));
if (!map->search_freecell(NULL, sd->bl.m, &x, &y, 10, 10, 1))
@@ -2224,11 +2224,11 @@ ACMD(gat) {
for (y = 2; y >= -2; y--) {
safesnprintf(atcmd_output, sizeof(atcmd_output), "%s (x= %d, y= %d) %02X %02X %02X %02X %02X",
map->list[sd->bl.m].name, sd->bl.x - 2, sd->bl.y + y,
- map->getcell(sd->bl.m, sd->bl.x - 2, sd->bl.y + y, CELL_GETTYPE),
- map->getcell(sd->bl.m, sd->bl.x - 1, sd->bl.y + y, CELL_GETTYPE),
- map->getcell(sd->bl.m, sd->bl.x, sd->bl.y + y, CELL_GETTYPE),
- map->getcell(sd->bl.m, sd->bl.x + 1, sd->bl.y + y, CELL_GETTYPE),
- map->getcell(sd->bl.m, sd->bl.x + 2, sd->bl.y + y, CELL_GETTYPE));
+ map->getcell(sd->bl.m, &sd->bl, sd->bl.x - 2, sd->bl.y + y, CELL_GETTYPE),
+ map->getcell(sd->bl.m, &sd->bl, sd->bl.x - 1, sd->bl.y + y, CELL_GETTYPE),
+ map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y + y, CELL_GETTYPE),
+ map->getcell(sd->bl.m, &sd->bl, sd->bl.x + 1, sd->bl.y + y, CELL_GETTYPE),
+ map->getcell(sd->bl.m, &sd->bl, sd->bl.x + 2, sd->bl.y + y, CELL_GETTYPE));
clif->message(fd, atcmd_output);
}
@@ -7898,7 +7898,7 @@ ACMD(clone) {
do {
x = sd->bl.x + (rnd() % 10 - 5);
y = sd->bl.y + (rnd() % 10 - 5);
- } while (map->getcell(sd->bl.m,x,y,CELL_CHKNOPASS) && i++ < 10);
+ } while (map->getcell(sd->bl.m, &sd->bl, x, y, CELL_CHKNOPASS) && i++ < 10);
if (i >= 10) {
x = sd->bl.x;
diff --git a/src/map/battle.c b/src/map/battle.c
index 8681d5efd..d7f12aba9 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -6364,7 +6364,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
m = target->m;
- if (flag&BCT_ENEMY && ( map->getcell(m,src->x,src->y,CELL_CHKBASILICA) || map->getcell(m,target->x,target->y,CELL_CHKBASILICA) ) ) {
+ if (flag & BCT_ENEMY && (map->getcell(m, src, src->x, src->y, CELL_CHKBASILICA) || map->getcell(m, src, target->x, target->y, CELL_CHKBASILICA))) {
return -1;
}
diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c
index e01b8a1d8..67018ec1f 100644
--- a/src/map/buyingstore.c
+++ b/src/map/buyingstore.c
@@ -46,7 +46,7 @@ bool buyingstore_setup(struct map_session_data* sd, unsigned char slots)
return false;
}
- if( map->getcell(sd->bl.m, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING) ) {
+ if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING)) {
// custom: no vending cells
clif->message(sd->fd, msg_sd(sd,204)); // "You can't open a shop on this cell."
return false;
@@ -100,7 +100,7 @@ void buyingstore_create(struct map_session_data* sd, int zenylimit, unsigned cha
return;
}
- if( map->getcell(sd->bl.m, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING) ) {
+ if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING)) {
// custom: no vending cells
clif->message(sd->fd, msg_sd(sd,204)); // "You can't open a shop on this cell."
return;
diff --git a/src/map/chat.c b/src/map/chat.c
index c53d23889..976b1ce8e 100644
--- a/src/map/chat.c
+++ b/src/map/chat.c
@@ -94,7 +94,7 @@ bool chat_createpcchat(struct map_session_data* sd, const char* title, const cha
return false; //Can't create chatrooms on this map.
}
- if( map->getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOCHAT) ) {
+ if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNOCHAT) ) {
clif->message (sd->fd, msg_sd(sd,865)); // "Can't create chat rooms in this area."
return false;
}
diff --git a/src/map/clif.c b/src/map/clif.c
index 55d7c11ba..ab5708fc8 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -9560,7 +9560,7 @@ void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) {
clif->guild_notice(sd, sd->guild);
// For automatic triggering of NPCs after map loading (so you don't need to walk 1 step first)
- if (map->getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNPC))
+ if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNPC))
npc->touch_areanpc(sd,sd->bl.m,sd->bl.x,sd->bl.y);
else
npc->untouch_areanpc(sd, sd->bl.m, sd->bl.x, sd->bl.y);
@@ -12836,7 +12836,7 @@ void clif_parse_OpenVending(int fd, struct map_session_data* sd) {
clif->message (sd->fd, msg_sd(sd,276)); // "You can't open a shop on this map"
return;
}
- if( map->getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOVENDING) ) {
+ if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING)) {
clif->message (sd->fd, msg_sd(sd,204)); // "You can't open a shop on this cell."
return;
}
diff --git a/src/map/map.c b/src/map/map.c
index ab34799ee..cd0f516ed 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1407,7 +1407,7 @@ int map_searchrandfreecell(int16 m,int16 *x,int16 *y,int stack) {
for(j=-1;j<=1;j++){
if(j+*x<0 || j+*x>=map->list[m].xs)
continue;
- if(map->getcell(m,j+*x,i+*y,CELL_CHKNOPASS) && !map->getcell(m,j+*x,i+*y,CELL_CHKICEWALL))
+ if (map->getcell(m, NULL, j + *x, i + *y, CELL_CHKNOPASS) && !map->getcell(m, NULL, j + *x, i + *y, CELL_CHKICEWALL))
continue;
//Avoid item stacking to prevent against exploits. [Skotlex]
if(stack && map->count_oncell(m,j+*x,i+*y, BL_ITEM, 0) > stack)
@@ -1466,7 +1466,7 @@ int map_search_freecell(struct block_list *src, int16 m, int16 *x,int16 *y, int1
//No range? Return the target cell then....
*x = bx;
*y = by;
- return map->getcell(m,*x,*y,CELL_CHKREACH);
+ return map->getcell(m, src, *x, *y, CELL_CHKREACH);
}
if (rx >= 0 && ry >= 0) {
@@ -1484,7 +1484,7 @@ int map_search_freecell(struct block_list *src, int16 m, int16 *x,int16 *y, int1
if (*x == bx && *y == by)
continue; //Avoid picking the same target tile.
- if (map->getcell(m,*x,*y,CELL_CHKREACH)) {
+ if (map->getcell(m, src, *x, *y, CELL_CHKREACH)) {
if(flag&2 && !unit->can_reach_pos(src, *x, *y, 1))
continue;
if(flag&4) {
@@ -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,tx,ty,CELL_CHKPASS)) {
+ if (!map->count_oncell(m, tx, ty, type, flag) && map->getcell(m, NULL, 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,tx,ty,CELL_CHKPASS)) {
+ if (!map->count_oncell(m, tx, ty, type, flag) && map->getcell(m, NULL, 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,tx,ty,CELL_CHKPASS)) {
+ if (!map->count_oncell(m, tx, ty, type, flag) && map->getcell(m, NULL, 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,tx,ty,CELL_CHKPASS)) {
+ if (!map->count_oncell(m, tx, ty, type, flag) && map->getcell(m, NULL, tx, ty, CELL_CHKPASS)) {
*x = tx;
*y = ty;
return true;
@@ -2567,8 +2567,8 @@ int map_random_dir(struct block_list *bl, int16 *x, int16 *y)
xi = bl->x + segment*dirx[j];
segment = (short)sqrt((float)(dist2 - segment*segment)); //The complement of the previously picked segment
yi = bl->y + segment*diry[j];
- } while ( (map->getcell(bl->m,xi,yi,CELL_CHKNOPASS) || !path->search(NULL,bl,bl->m,bl->x,bl->y,xi,yi,1,CELL_CHKNOREACH))
- && (++i)<100 );
+ } while ((map->getcell(bl->m, bl, xi, yi, CELL_CHKNOPASS) || !path->search(NULL, bl, bl->m, bl->x, bl->y, xi, yi, 1, CELL_CHKNOREACH))
+ && (++i)<100);
if (i < 100) {
*x = xi;
@@ -2640,11 +2640,11 @@ void map_cellfromcache(struct map_data *m) {
/*==========================================
* Confirm if celltype in (m,x,y) match the one given in cellchk
*------------------------------------------*/
-int map_getcell(int16 m,int16 x,int16 y,cell_chk cellchk) {
- return (m < 0 || m >= map->count) ? 0 : map->list[m].getcellp(&map->list[m],x,y,cellchk);
+int map_getcell(int16 m, const struct block_list *bl, int16 x, int16 y, cell_chk cellchk) {
+ return (m < 0 || m >= map->count) ? 0 : map->list[m].getcellp(&map->list[m], bl, x, y, cellchk);
}
-int map_getcellp(struct map_data* m,int16 x,int16 y,cell_chk cellchk) {
+int map_getcellp(struct map_data* m, const struct block_list *bl, int16 x, int16 y, cell_chk cellchk) {
struct mapcell cell;
nullpo_ret(m);
@@ -2715,12 +2715,13 @@ int map_getcellp(struct map_data* m,int16 x,int16 y,cell_chk cellchk) {
}
/* [Ind/Hercules] */
-int map_sub_getcellp(struct map_data* m,int16 x,int16 y,cell_chk cellchk) {
+int map_sub_getcellp(struct map_data* m, const struct block_list *bl, int16 x, int16 y, cell_chk cellchk) {
map->cellfromcache(m);
m->getcellp = map->getcellp;
m->setcell = map->setcell;
- return m->getcellp(m,x,y,cellchk);
+ return m->getcellp(m, bl, x, y, cellchk);
}
+
/*==========================================
* Change the type/flags of a map cell
* 'cell' - which flag to modify
@@ -2808,7 +2809,7 @@ bool map_iwall_set(int16 m, int16 x, int16 y, int size, int8 dir, bool shootable
if( (iwall = (struct iwall_data *)strdb_get(map->iwall_db, wall_name)) != NULL )
return false; // Already Exists
- if( map->getcell(m, x, y, CELL_CHKNOREACH) )
+ if (map->getcell(m, NULL, x, y, CELL_CHKNOREACH))
return false; // Starting cell problem
CREATE(iwall, struct iwall_data, 1);
@@ -2823,13 +2824,13 @@ bool map_iwall_set(int16 m, int16 x, int16 y, int size, int8 dir, bool shootable
for( i = 0; i < size; i++ ) {
map->iwall_nextxy(x, y, dir, i, &x1, &y1);
- if( map->getcell(m, x1, y1, CELL_CHKNOREACH) )
+ if (map->getcell(m, NULL, x1, y1, CELL_CHKNOREACH))
break; // Collision
map->list[m].setcell(m, x1, y1, CELL_WALKABLE, false);
map->list[m].setcell(m, x1, y1, CELL_SHOOTABLE, shootable);
- clif->changemapcell(0, m, x1, y1, map->getcell(m, x1, y1, CELL_GETTYPE), ALL_SAMEMAP);
+ clif->changemapcell(0, m, x1, y1, map->getcell(m, NULL, x1, y1, CELL_GETTYPE), ALL_SAMEMAP);
}
iwall->size = i;
@@ -2856,7 +2857,7 @@ void map_iwall_get(struct map_session_data *sd) {
for( i = 0; i < iwall->size; i++ ) {
map->iwall_nextxy(iwall->x, iwall->y, iwall->dir, i, &x1, &y1);
- clif->changemapcell(sd->fd, iwall->m, x1, y1, map->getcell(iwall->m, x1, y1, CELL_GETTYPE), SELF);
+ clif->changemapcell(sd->fd, iwall->m, x1, y1, map->getcell(iwall->m, &sd->bl, x1, y1, CELL_GETTYPE), SELF);
}
}
dbi_destroy(iter);
@@ -2876,7 +2877,7 @@ void map_iwall_remove(const char *wall_name)
map->list[iwall->m].setcell(iwall->m, x1, y1, CELL_SHOOTABLE, true);
map->list[iwall->m].setcell(iwall->m, x1, y1, CELL_WALKABLE, true);
- clif->changemapcell(0, iwall->m, x1, y1, map->getcell(iwall->m, x1, y1, CELL_GETTYPE), ALL_SAMEMAP);
+ clif->changemapcell(0, iwall->m, x1, y1, map->getcell(iwall->m, NULL, x1, y1, CELL_GETTYPE), ALL_SAMEMAP);
}
map->list[iwall->m].iwall_num--;
diff --git a/src/map/map.h b/src/map/map.h
index d4ab954be..caff2cfc8 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -719,7 +719,7 @@ struct map_data {
bool custom_name; ///< Whether the instanced map is using a custom name
/* */
- int (*getcellp)(struct map_data* m,int16 x,int16 y,cell_chk cellchk);
+ int (*getcellp)(struct map_data* m, const struct block_list *bl, int16 x, int16 y, cell_chk cellchk);
void (*setcell) (int16 m, int16 x, int16 y, cell_t cell, bool flag);
char *cellPos;
@@ -924,7 +924,7 @@ END_ZEROED_BLOCK;
void (*zone_change) (int m, struct map_zone_data *zone, const char* start, const char* buffer, const char* filepath);
void (*zone_change2) (int m, struct map_zone_data *zone);
- int (*getcell) (int16 m,int16 x,int16 y,cell_chk cellchk);
+ int (*getcell) (int16 m, const struct block_list *bl, int16 x, int16 y, cell_chk cellchk);
void (*setgatcell) (int16 m, int16 x, int16 y, int gat);
void (*cellfromcache) (struct map_data *m);
@@ -1048,9 +1048,9 @@ END_ZEROED_BLOCK;
int (*removemobs_sub) (struct block_list *bl, va_list ap);
struct mapcell (*gat2cell) (int gat);
int (*cell2gat) (struct mapcell cell);
- int (*getcellp) (struct map_data *m, int16 x, int16 y, cell_chk cellchk);
+ int (*getcellp) (struct map_data *m, const struct block_list *bl, int16 x, int16 y, cell_chk cellchk);
void (*setcell) (int16 m, int16 x, int16 y, cell_t cell, bool flag);
- int (*sub_getcellp) (struct map_data *m, int16 x, int16 y, cell_chk cellchk);
+ int (*sub_getcellp) (struct map_data *m, const struct block_list *bl, int16 x, int16 y, cell_chk cellchk);
void (*sub_setcell) (int16 m, int16 x, int16 y, cell_t cell, bool flag);
void (*iwall_nextxy) (int16 x, int16 y, int8 dir, int pos, int16 *x1, int16 *y1);
DBData (*create_map_data_other_server) (DBKey key, va_list args);
diff --git a/src/map/mob.c b/src/map/mob.c
index 4e61cfeb6..2bc0ba112 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -545,7 +545,7 @@ int mob_once_spawn_area(struct map_session_data* sd, int16 m, int16 x0, int16 y0
x = rnd()%(x1-x0+1)+x0;
y = rnd()%(y1-y0+1)+y0;
j++;
- } while (map->getcell(m,x,y,CELL_CHKNOPASS) && j < max);
+ } while (map->getcell(m, NULL, x, y, CELL_CHKNOPASS) && j < max);
if (j == max)
{// attempt to find an available cell failed
@@ -1344,7 +1344,7 @@ int mob_randomwalk(struct mob_data *md, int64 tick) {
x+=md->bl.x;
y+=md->bl.y;
- if(((x != md->bl.x) || (y != md->bl.y)) && map->getcell(md->bl.m,x,y,CELL_CHKPASS) && unit->walktoxy(&md->bl,x,y,8)){
+ if (((x != md->bl.x) || (y != md->bl.y)) && map->getcell(md->bl.m, &md->bl, x, y, CELL_CHKPASS) && unit->walktoxy(&md->bl, x, y, 8)) {
break;
}
}
@@ -1382,7 +1382,7 @@ int mob_warpchase(struct mob_data *md, struct block_list *target)
return 0; //No need to do a warp chase.
if (md->ud.walktimer != INVALID_TIMER &&
- map->getcell(md->bl.m,md->ud.to_x,md->ud.to_y,CELL_CHKNPC))
+ map->getcell(md->bl.m, &md->bl, md->ud.to_x, md->ud.to_y, CELL_CHKNPC))
return 1; //Already walking to a warp.
//Search for warps within mob's viewing range.
diff --git a/src/map/npc.c b/src/map/npc.c
index 7428070ab..fe7ba693f 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -1099,7 +1099,7 @@ int npc_check_areanpc(int flag, int16 m, int16 x, int16 y, int16 range) {
i = 0;
for (ys = y0; ys <= y1 && !i; ys++) {
for(xs = x0; xs <= x1 && !i; xs++) {
- if (map->getcell(m,xs,ys,CELL_CHKNPC))
+ if (map->getcell(m, NULL, xs, ys, CELL_CHKNPC))
i = 1;
}
}
@@ -3300,7 +3300,7 @@ void npc_setcells(struct npc_data* nd) {
for (i = y-ys; i <= y+ys; i++) {
for (j = x-xs; j <= x+xs; j++) {
- if (map->getcell(m, j, i, CELL_CHKNOPASS))
+ if (map->getcell(m, &nd->bl, j, i, CELL_CHKNOPASS))
continue;
map->list[m].setcell(m, j, i, CELL_NPC, true);
}
@@ -3337,10 +3337,10 @@ void npc_unsetcells(struct npc_data* nd) {
//Locate max range on which we can locate npc cells
//FIXME: does this really do what it's supposed to do? [ultramage]
- for(x0 = x-xs; x0 > 0 && map->getcell(m, x0, y, CELL_CHKNPC); x0--);
- for(x1 = x+xs; x1 < map->list[m].xs-1 && map->getcell(m, x1, y, CELL_CHKNPC); x1++);
- for(y0 = y-ys; y0 > 0 && map->getcell(m, x, y0, CELL_CHKNPC); y0--);
- for(y1 = y+ys; y1 < map->list[m].ys-1 && map->getcell(m, x, y1, CELL_CHKNPC); y1++);
+ for(x0 = x-xs; x0 > 0 && map->getcell(m, &nd->bl, x0, y, CELL_CHKNPC); x0--);
+ for(x1 = x+xs; x1 < map->list[m].xs-1 && map->getcell(m, &nd->bl, x1, y, CELL_CHKNPC); x1++);
+ for(y0 = y-ys; y0 > 0 && map->getcell(m, &nd->bl, x, y0, CELL_CHKNPC); y0--);
+ for(y1 = y+ys; y1 < map->list[m].ys-1 && map->getcell(m, &nd->bl, x, y1, CELL_CHKNPC); y1++);
//Erase this npc's cells
for (i = y-ys; i <= y+ys; i++)
@@ -4580,14 +4580,14 @@ void npc_debug_warps_sub(struct npc_data* nd) {
if (m < 0) return; //Warps to another map, nothing to do about it.
if (nd->u.warp.x == 0 && nd->u.warp.y == 0) return; // random warp
- if (map->getcell(m, nd->u.warp.x, nd->u.warp.y, CELL_CHKNPC)) {
+ if (map->getcell(m, &nd->bl, nd->u.warp.x, nd->u.warp.y, CELL_CHKNPC)) {
ShowWarning("Warp %s at %s(%d,%d) warps directly on top of an area npc at %s(%d,%d)\n",
nd->name,
map->list[nd->bl.m].name, nd->bl.x, nd->bl.y,
map->list[m].name, nd->u.warp.x, nd->u.warp.y
);
}
- if (map->getcell(m, nd->u.warp.x, nd->u.warp.y, CELL_CHKNOPASS)) {
+ if (map->getcell(m, &nd->bl, nd->u.warp.x, nd->u.warp.y, CELL_CHKNOPASS)) {
ShowWarning("Warp %s at %s(%d,%d) warps to a non-walkable tile at %s(%d,%d)\n",
nd->name,
map->list[nd->bl.m].name, nd->bl.x, nd->bl.y,
diff --git a/src/map/path.c b/src/map/path.c
index d56994fb4..7d6cd5490 100644
--- a/src/map/path.c
+++ b/src/map/path.c
@@ -88,7 +88,7 @@ int path_blownpos(struct block_list *bl, int16 m,int16 x0,int16 y0,int16 dx,int1
}
while( count > 0 && (dx != 0 || dy != 0) ) {
- if( !md->getcellp(md,x0+dx,y0+dy,CELL_CHKPASS) )
+ if (!md->getcellp(md, bl, x0 + dx, y0 + dy, CELL_CHKPASS))
break;
x0 += dx;
@@ -159,7 +159,7 @@ bool path_search_long(struct shootpath_data *spd,struct block_list *bl,int16 m,i
spd->y[spd->len] = y0;
spd->len++;
}
- if (md->getcellp(md,x0,y0,cell))
+ if (md->getcellp(md, bl, x0, y0, cell))
return false;
}
@@ -250,11 +250,11 @@ bool path_search(struct walkpath_data *wpd, struct block_list *bl, int16 m, int1
md = &map->list[m];
//Do not check starting cell as that would get you stuck.
- if (x0 < 0 || x0 >= md->xs || y0 < 0 || y0 >= md->ys /*|| md->getcellp(md,x0,y0,cell)*/)
+ if (x0 < 0 || x0 >= md->xs || y0 < 0 || y0 >= md->ys /*|| md->getcellp(md, bl, x0, y0, cell)*/)
return false;
// Check destination cell
- if (x1 < 0 || x1 >= md->xs || y1 < 0 || y1 >= md->ys || md->getcellp(md,x1,y1,cell))
+ if (x1 < 0 || x1 >= md->xs || y1 < 0 || y1 >= md->ys || md->getcellp(md, bl, x1, y1, cell))
return false;
if( x0 == x1 && y0 == y1 ) {
@@ -287,7 +287,7 @@ bool path_search(struct walkpath_data *wpd, struct block_list *bl, int16 m, int1
if( dx == 0 && dy == 0 )
break; // success
- if( md->getcellp(md,x,y,cell) )
+ if (md->getcellp(md, bl, x, y, cell))
break; // obstacle = failure
}
@@ -360,26 +360,26 @@ bool path_search(struct walkpath_data *wpd, struct block_list *bl, int16 m, int1
break;
}
- if (y < ys && !md->getcellp(md, x, y+1, cell)) allowed_dirs |= DIR_NORTH;
- if (y > 0 && !md->getcellp(md, x, y-1, cell)) allowed_dirs |= DIR_SOUTH;
- if (x < xs && !md->getcellp(md, x+1, y, cell)) allowed_dirs |= DIR_EAST;
- if (x > 0 && !md->getcellp(md, x-1, y, cell)) allowed_dirs |= DIR_WEST;
+ if (y < ys && !md->getcellp(md, bl, x, y+1, cell)) allowed_dirs |= DIR_NORTH;
+ if (y > 0 && !md->getcellp(md, bl, x, y-1, cell)) allowed_dirs |= DIR_SOUTH;
+ if (x < xs && !md->getcellp(md, bl, x+1, y, cell)) allowed_dirs |= DIR_EAST;
+ if (x > 0 && !md->getcellp(md, bl, x-1, y, cell)) allowed_dirs |= DIR_WEST;
#define chk_dir(d) ((allowed_dirs & (d)) == (d))
// Process neighbors of current node
- if (chk_dir(DIR_SOUTH|DIR_EAST) && !md->getcellp(md, x+1, y-1, cell))
+ if (chk_dir(DIR_SOUTH|DIR_EAST) && !md->getcellp(md, bl, x+1, y-1, cell))
e += add_path(&open_set, tp, x+1, y-1, g_cost + MOVE_DIAGONAL_COST, current, heuristic(x+1, y-1, x1, y1)); // (x+1, y-1) 5
if (chk_dir(DIR_EAST))
e += add_path(&open_set, tp, x+1, y, g_cost + MOVE_COST, current, heuristic(x+1, y, x1, y1)); // (x+1, y) 6
- if (chk_dir(DIR_NORTH|DIR_EAST) && !md->getcellp(md, x+1, y+1, cell))
+ if (chk_dir(DIR_NORTH|DIR_EAST) && !md->getcellp(md, bl, x+1, y+1, cell))
e += add_path(&open_set, tp, x+1, y+1, g_cost + MOVE_DIAGONAL_COST, current, heuristic(x+1, y+1, x1, y1)); // (x+1, y+1) 7
if (chk_dir(DIR_NORTH))
e += add_path(&open_set, tp, x, y+1, g_cost + MOVE_COST, current, heuristic(x, y+1, x1, y1)); // (x, y+1) 0
- if (chk_dir(DIR_NORTH|DIR_WEST) && !md->getcellp(md, x-1, y+1, cell))
+ if (chk_dir(DIR_NORTH|DIR_WEST) && !md->getcellp(md, bl, x-1, y+1, cell))
e += add_path(&open_set, tp, x-1, y+1, g_cost + MOVE_DIAGONAL_COST, current, heuristic(x-1, y+1, x1, y1)); // (x-1, y+1) 1
if (chk_dir(DIR_WEST))
e += add_path(&open_set, tp, x-1, y, g_cost + MOVE_COST, current, heuristic(x-1, y, x1, y1)); // (x-1, y) 2
- if (chk_dir(DIR_SOUTH|DIR_WEST) && !md->getcellp(md, x-1, y-1, cell))
+ if (chk_dir(DIR_SOUTH|DIR_WEST) && !md->getcellp(md, bl, x-1, y-1, cell))
e += add_path(&open_set, tp, x-1, y-1, g_cost + MOVE_DIAGONAL_COST, current, heuristic(x-1, y-1, x1, y1)); // (x-1, y-1) 3
if (chk_dir(DIR_SOUTH))
e += add_path(&open_set, tp, x, y-1, g_cost + MOVE_COST, current, heuristic(x, y-1, x1, y1)); // (x, y-1) 4
diff --git a/src/map/pc.c b/src/map/pc.c
index 14d234d82..ca60261d1 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -5539,10 +5539,10 @@ int pc_setpos(struct map_session_data* sd, unsigned short map_index, int x, int
do {
x=rnd()%(map->list[m].xs-2)+1;
y=rnd()%(map->list[m].ys-2)+1;
- } while(map->getcell(m,x,y,CELL_CHKNOPASS));
+ } while(map->getcell(m, &sd->bl, x, y, CELL_CHKNOPASS));
}
- if (sd->state.vending && map->getcell(m,x,y,CELL_CHKNOVENDING)) {
+ if (sd->state.vending && map->getcell(m, &sd->bl, x, y, CELL_CHKNOVENDING)) {
clif->message (sd->fd, msg_sd(sd,204)); // "You can't open a shop on this cell."
vending->close(sd);
}
@@ -5614,7 +5614,7 @@ int pc_randomwarp(struct map_session_data *sd, clr_type type) {
do {
x=rnd()%(map->list[m].xs-2)+1;
y=rnd()%(map->list[m].ys-2)+1;
- } while( map->getcell(m,x,y,CELL_CHKNOPASS) && (i++) < 1000 );
+ } while (map->getcell(m, &sd->bl, x, y, CELL_CHKNOPASS) && (i++) < 1000 );
if (i < 1000)
return pc->setpos(sd,map_id2index(sd->bl.m),x,y,type);
diff --git a/src/map/pet.c b/src/map/pet.c
index 81a61459f..d2bb96ef5 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -795,7 +795,7 @@ int pet_randomwalk(struct pet_data *pd, int64 tick)
int r=rnd();
int x=pd->bl.x+r%(d*2+1)-d;
int y=pd->bl.y+r/(d*2+1)%(d*2+1)-d;
- if(map->getcell(pd->bl.m,x,y,CELL_CHKPASS) && unit->walktoxy(&pd->bl,x,y,0)) {
+ if(map->getcell (pd->bl.m, &pd->bl, x, y, CELL_CHKPASS) && unit->walktoxy(&pd->bl, x, y, 0)) {
pd->move_fail_count=0;
break;
}
diff --git a/src/map/script.c b/src/map/script.c
index 45274e3dd..74ddf2104 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -5824,7 +5824,7 @@ int buildin_areawarp_sub(struct block_list *bl,va_list ap)
tx = rnd()%(x3-x2+1)+x2;
ty = rnd()%(y3-y2+1)+y2;
j++;
- } while( map->getcell(index,tx,ty,CELL_CHKNOPASS) && j < max );
+ } while (map->getcell(index, bl, tx, ty, CELL_CHKNOPASS) && j < max);
pc->setpos((TBL_PC *)bl,index,tx,ty,CLR_OUTSIGHT);
}
@@ -16841,13 +16841,14 @@ BUILDIN(checkcell) {
int16 x = script_getnum(st,3);
int16 y = script_getnum(st,4);
cell_chk type = (cell_chk)script_getnum(st,5);
+ TBL_PC* sd = script->rid2sd(st);
if ( m == -1 ) {
ShowWarning("checkcell: Attempted to run on unexsitent map '%s', type %d, x/y %d,%d\n",script_getstr(st,2),type,x,y);
return true;
}
- script_pushint(st, map->getcell(m, x, y, type));
+ script_pushint(st, map->getcell(m, &sd->bl, x, y, type));
return true;
}
diff --git a/src/map/skill.c b/src/map/skill.c
index b61e5d8d9..63116db98 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -2731,7 +2731,7 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr
short dir_x, dir_y;
dir_x = dirx[(dir+4)%8];
dir_y = diry[(dir+4)%8];
- if( map->getcell(bl->m, bl->x+dir_x, bl->y+dir_y, CELL_CHKNOPASS) != 0 )
+ if (map->getcell(bl->m, bl, bl->x + dir_x, bl->y + dir_y, CELL_CHKNOPASS) != 0)
skill->addtimerskill(src, tick + 300 * ((flag&2) ? 1 : 2), bl->id, 0, 0, skill_id, skill_lv, BF_WEAPON, flag|4);
}
break;
@@ -3377,7 +3377,7 @@ int skill_timerskill(int tid, int64 tick, int id, intptr_t data) {
if( path->search_long(NULL, src, src->m, src->x, src->y, x, y, CELL_CHKWALL) )
skill->unitsetting(src,skl->skill_id,skl->skill_lv,x,y,skl->flag);
if( path->search_long(NULL, src, src->m, src->x, src->y, skl->x, skl->y, CELL_CHKWALL)
- && !map->getcell(src->m, skl->x, skl->y, CELL_CHKLANDPROTECTOR) )
+ && !map->getcell(src->m, src, skl->x, skl->y, CELL_CHKLANDPROTECTOR) )
clif->skill_poseffect(src,skl->skill_id,skl->skill_lv,skl->x,skl->y,tick);
}
else if( path->search_long(NULL, src, src->m, src->x, src->y, skl->x, skl->y, CELL_CHKWALL) )
@@ -4044,7 +4044,7 @@ int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint1
tx -= dirx[dir];
ty -= diry[dir];
// If target cell is a wall then break
- if(map->getcell(bl->m,tx,ty,CELL_CHKWALL))
+ if(map->getcell(bl->m, bl, tx, ty, CELL_CHKWALL))
break;
skill->blown(src,bl,1,dir,0);
// Splash around target cell, but only cells inside area; we first have to check the area is not negative
@@ -4175,7 +4175,7 @@ int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint1
for( y = src->y - range; y <= src->y + range; ++y )
for( x = src->x - range; x <= src->x + range; ++x ) {
if( !map->find_skill_unit_oncell(src,x,y,SA_LANDPROTECTOR,NULL,1) ) {
- if( src->type != BL_PC || map->getcell(src->m,x,y,CELL_CHKWATER) ) // non-players bypass the water requirement
+ if (src->type != BL_PC || map->getcell(src->m, src, x, y, CELL_CHKWATER)) // non-players bypass the water requirement
count++; // natural water cell
else if( (su = map->find_skill_unit_oncell(src,x,y,SA_DELUGE,NULL,1)) != NULL
|| (su = map->find_skill_unit_oncell(src,x,y,NJ_SUITON,NULL,1)) != NULL ) {
@@ -7083,7 +7083,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
}
clif->skill_nodamage(src,bl,TK_HIGHJUMP,skill_lv,1);
- if(!map->count_oncell(src->m,x,y,BL_PC|BL_NPC|BL_MOB,0) && map->getcell(src->m,x,y,CELL_CHKREACH)) {
+ if (!map->count_oncell(src->m, x, y, BL_PC | BL_NPC | BL_MOB, 0) && map->getcell(src->m, src, x, y, CELL_CHKREACH)) {
clif->slide(src,x,y);
unit->movepos(src, x, y, 1, 0);
}
@@ -7902,7 +7902,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
if ((dstsd = g->member[i].sd) != NULL && sd != dstsd && !dstsd->state.autotrade && !pc_isdead(dstsd)) {
if (map->list[dstsd->bl.m].flag.nowarp && !map_flag_gvg2(dstsd->bl.m))
continue;
- if(map->getcell(src->m,src->x+dx[j],src->y+dy[j],CELL_CHKNOREACH))
+ if (map->getcell(src->m, src, src->x + dx[j], src->y + dy[j], CELL_CHKNOREACH))
dx[j] = dy[j] = 0;
pc->setpos(dstsd, map_id2index(src->m), src->x+dx[j], src->y+dy[j], CLR_RESPAWN);
}
@@ -10460,8 +10460,8 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
tmpx = x - area + rnd()%(area * 2 + 1);
tmpy = y - area + rnd()%(area * 2 + 1);
- if( i == 0 && path->search_long(NULL, src, src->m, src->x, src->y, tmpx, tmpy, CELL_CHKWALL)
- && !map->getcell(src->m, tmpx, tmpy, CELL_CHKLANDPROTECTOR))
+ if (i == 0 && path->search_long(NULL, src, src->m, src->x, src->y, tmpx, tmpy, CELL_CHKWALL)
+ && !map->getcell(src->m, src, tmpx, tmpy, CELL_CHKLANDPROTECTOR))
clif->skill_poseffect(src,skill_id,skill_lv,tmpx,tmpy,tick);
if( i > 0 )
@@ -11119,7 +11119,7 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_
break;
case WZ_FIREPILLAR:
- if( map->getcell(src->m, x, y, CELL_CHKLANDPROTECTOR) )
+ if (map->getcell(src->m, src, x, y, CELL_CHKLANDPROTECTOR))
return NULL;
if((flag&1)!=0)
limit=1000;
@@ -11128,7 +11128,7 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_
case WZ_QUAGMIRE: //The target changes to "all" if used in a gvg map. [Skotlex]
case AM_DEMONSTRATION:
case GN_HELLS_PLANT:
- if( skill_id == GN_HELLS_PLANT && map->getcell(src->m, x, y, CELL_CHKLANDPROTECTOR) )
+ if (skill_id == GN_HELLS_PLANT && map->getcell(src->m, src, x, y, CELL_CHKLANDPROTECTOR))
return NULL;
if (map_flag_vs(src->m) && battle_config.vs_traps_bctall
&& (src->type&battle_config.vs_traps_bctall))
@@ -11370,7 +11370,7 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_
case SO_FIRE_INSIGNIA:
case SO_WIND_INSIGNIA:
case SO_EARTH_INSIGNIA:
- if( map->getcell(src->m, x, y, CELL_CHKLANDPROTECTOR) )
+ if (map->getcell(src->m, src, x, y, CELL_CHKLANDPROTECTOR))
return NULL;
break;
case SO_CLOUD_KILL:
@@ -11451,7 +11451,7 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_
val1 = skill_lv;
val2 = 0;
- if( !group->state.song_dance && !map->getcell(src->m,ux,uy,CELL_CHKREACH) )
+ if (!group->state.song_dance && !map->getcell(src->m, src, ux, uy, CELL_CHKREACH))
continue; // don't place skill units on walls (except for songs/dances/encores)
if( battle_config.skill_wall_check && skill->get_unit_flag(skill_id)&UF_PATHCHECK && !path->search_long(NULL,src,src->m,ux,uy,x,y,CELL_CHKWALL) )
continue; // no path between cell and center of casting.
@@ -11463,7 +11463,7 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_
break;
case WZ_ICEWALL:
val1 = (skill_lv <= 1) ? 500 : 200 + 200*skill_lv;
- val2 = map->getcell(src->m, ux, uy, CELL_GETTYPE);
+ val2 = map->getcell(src->m, src, ux, uy, CELL_GETTYPE);
break;
case HT_LANDMINE:
case MA_LANDMINE:
@@ -11575,14 +11575,14 @@ int skill_unit_onplace(struct skill_unit *src, struct block_list *bl, int64 tick
nullpo_ret(sg=src->group);
nullpo_ret(ss=map->id2bl(sg->src_id));
- if( skill->get_type(sg->skill_id) == BF_MAGIC && map->getcell(src->bl.m, src->bl.x, src->bl.y, CELL_CHKLANDPROTECTOR) && sg->skill_id != SA_LANDPROTECTOR )
+ if (skill->get_type(sg->skill_id) == BF_MAGIC && map->getcell(src->bl.m, &src->bl, src->bl.x, src->bl.y, CELL_CHKLANDPROTECTOR) && sg->skill_id != SA_LANDPROTECTOR)
return 0; //AoE skills are ineffective. [Skotlex]
sc = status->get_sc(bl);
if (sc && sc->option&OPTION_HIDE && sg->skill_id != WZ_HEAVENDRIVE && sg->skill_id != WL_EARTHSTRAIN )
return 0; //Hidden characters are immune to AoE skills except to these. [Skotlex]
- if (sc && sc->data[SC_VACUUM_EXTREME] && map->getcell(bl->m, bl->x, bl->y, CELL_CHKLANDPROTECTOR))
+ if (sc && sc->data[SC_VACUUM_EXTREME] && map->getcell(bl->m, bl, bl->x, bl->y, CELL_CHKLANDPROTECTOR))
status_change_end(bl, SC_VACUUM_EXTREME, INVALID_TIMER);
if ( sc && sc->data[SC_HOVERING] && ( sg->skill_id == SO_VACUUM_EXTREME || sg->skill_id == SO_ELECTRICWALK || sg->skill_id == SO_FIREWALK || sg->skill_id == WZ_QUAGMIRE ) )
@@ -13379,7 +13379,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
for (i=0;i<size*size;i++) {
int x = sd->bl.x+(i%size-range);
int y = sd->bl.y+(i/size-range);
- if (map->getcell(sd->bl.m,x,y,CELL_CHKWALL)) {
+ if (map->getcell(sd->bl.m, &sd->bl, x, y, CELL_CHKWALL)) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
}
@@ -13831,7 +13831,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
case ST_WATER:
if (sc && (sc->data[SC_DELUGE] || sc->data[SC_NJ_SUITON]))
break;
- if (map->getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKWATER))
+ if (map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y, CELL_CHKWATER))
break;
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
@@ -15823,7 +15823,7 @@ bool skill_check_cloaking(struct block_list *bl, struct status_change_entry *sce
) {
//Check for walls.
int i;
- ARR_FIND( 0, 8, i, map->getcell(bl->m, bl->x+dx[i], bl->y+dy[i], CELL_CHKNOPASS) != 0 );
+ ARR_FIND( 0, 8, i, map->getcell(bl->m, bl, bl->x+dx[i], bl->y+dy[i], CELL_CHKNOPASS) != 0 );
if( i == 8 )
wall = false;
}
@@ -15884,7 +15884,7 @@ bool skill_check_camouflage(struct block_list *bl, struct status_change_entry *s
if( bl->type == BL_PC ) { //Check for walls.
int i;
- ARR_FIND( 0, 8, i, map->getcell(bl->m, bl->x+dx[i], bl->y+dy[i], CELL_CHKNOPASS) != 0 );
+ ARR_FIND( 0, 8, i, map->getcell(bl->m, bl, bl->x+dx[i], bl->y+dy[i], CELL_CHKNOPASS) != 0 );
if( i == 8 )
wall = false;
}
@@ -16355,7 +16355,7 @@ int skill_unit_timer_sub_onplace(struct block_list* bl, va_list ap) {
nullpo_ret(group);
- if( !(skill->get_inf2(group->skill_id)&(INF2_SONG_DANCE|INF2_TRAP|INF2_NOLP)) && map->getcell(su->bl.m, su->bl.x, su->bl.y, CELL_CHKLANDPROTECTOR) )
+ if (!(skill->get_inf2(group->skill_id)&(INF2_SONG_DANCE|INF2_TRAP|INF2_NOLP)) && map->getcell(su->bl.m, &su->bl, su->bl.x, su->bl.y, CELL_CHKLANDPROTECTOR))
return 0; //AoE skills are ineffective. [Skotlex]
if( battle->check_target(&su->bl,bl,group->target_flag) <= 0 )
diff --git a/src/map/status.c b/src/map/status.c
index 5ba0c688c..9a95b023c 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -1630,7 +1630,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin
break;
case AL_TELEPORT:
//Should fail when used on top of Land Protector [Skotlex]
- if (src && map->getcell(src->m, src->x, src->y, CELL_CHKLANDPROTECTOR)
+ if (src && map->getcell(src->m, src, src->x, src->y, CELL_CHKLANDPROTECTOR)
&& !(st->mode&MD_BOSS)
&& (src->type != BL_PC || ((TBL_PC*)src)->skillitem != skill_id))
return 0;
@@ -10440,7 +10440,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
skill->unit_move(bl,timer->gettick(),1);
if (opt_flag & 2 && sd) {
- if (map->getcell(bl->m,bl->x,bl->y,CELL_CHKNPC))
+ if (map->getcell(bl->m, bl, bl->x, bl->y, CELL_CHKNPC))
npc->touch_areanpc(sd,bl->m,bl->x,bl->y); //Trigger on-touch event.
else
npc->untouch_areanpc(sd, bl->m, bl->x, bl->y);
diff --git a/src/map/unit.c b/src/map/unit.c
index 178fc3010..2d8776d53 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -268,13 +268,13 @@ int unit_walktoxy_timer(int tid, int64 tick, int id, intptr_t data) {
icewall_walk_block = 0;
//Monsters will walk into an icewall from the west and south if they already started walking
- if(map->getcell(bl->m,x+dx,y+dy,CELL_CHKNOPASS)
- && (icewall_walk_block == 0 || !map->getcell(bl->m,x+dx,y+dy,CELL_CHKICEWALL) || dx < 0 || dy < 0))
+ if (map->getcell(bl->m, bl, x + dx, y + dy, CELL_CHKNOPASS)
+ && (icewall_walk_block == 0 || !map->getcell(bl->m, bl, x + dx, y + dy, CELL_CHKICEWALL) || dx < 0 || dy < 0))
return unit->walktoxy_sub(bl);
//Monsters can only leave icewalls to the west and south
//But if movement fails more than icewall_walk_block times, they can ignore this rule
- if(md && md->walktoxy_fail_count < icewall_walk_block && map->getcell(bl->m,x,y,CELL_CHKICEWALL) && (dx > 0 || dy > 0)) {
+ if (md && md->walktoxy_fail_count < icewall_walk_block && map->getcell(bl->m, bl, x, y, CELL_CHKICEWALL) && (dx > 0 || dy > 0)) {
//Needs to be done here so that rudeattack skills are invoked
md->walktoxy_fail_count++;
clif->fixpos(bl);
@@ -306,7 +306,7 @@ int unit_walktoxy_timer(int tid, int64 tick, int id, intptr_t data) {
if(sd) {
if( sd->touching_id )
npc->touchnext_areanpc(sd,false);
- if(map->getcell(bl->m,x,y,CELL_CHKNPC)) {
+ if (map->getcell(bl->m, bl, x, y, CELL_CHKNPC)) {
npc->touch_areanpc(sd,bl->m,x,y);
if (bl->prev == NULL) //Script could have warped char, abort remaining of the function.
return 0;
@@ -338,7 +338,7 @@ int unit_walktoxy_timer(int tid, int64 tick, int id, intptr_t data) {
} else if (md) {
//Movement was successful, reset walktoxy_fail_count
md->walktoxy_fail_count = 0;
- if( map->getcell(bl->m,x,y,CELL_CHKNPC) ) {
+ if (map->getcell(bl->m, bl, x, y, CELL_CHKNPC)) {
if( npc->touch_areanpc2(md) ) return 0; // Warped
} else
md->areanpc_id = 0;
@@ -683,7 +683,7 @@ bool unit_run( struct block_list *bl, struct map_session_data *sd, enum sc_type
// Search for available path
for(i = 0; i < AREA_SIZE; i++) {
- if(!map->getcell(bl->m,to_x+dir_x,to_y+dir_y,CELL_CHKPASS))
+ if (!map->getcell(bl->m, bl, to_x + dir_x, to_y + dir_y, CELL_CHKPASS))
break;
//if sprinting and there's a PC/Mob/NPC, block the path [Kevin]
@@ -720,7 +720,7 @@ bool unit_run( struct block_list *bl, struct map_session_data *sd, enum sc_type
//Makes bl attempt to run dist cells away from target. Uses hard-paths.
int unit_escape(struct block_list *bl, struct block_list *target, short dist) {
uint8 dir = map->calc_dir(target, bl->x, bl->y);
- while( dist > 0 && map->getcell(bl->m, bl->x + dist*dirx[dir], bl->y + dist*diry[dir], CELL_CHKNOREACH) )
+ while (dist > 0 && map->getcell(bl->m, bl, bl->x + dist * dirx[dir], bl->y + dist * diry[dir], CELL_CHKNOREACH))
dist--;
return ( dist > 0 && unit->walktoxy(bl, bl->x + dist*dirx[dir], bl->y + dist*diry[dir], 0) );
}
@@ -741,7 +741,7 @@ int unit_movepos(struct block_list *bl, short dst_x, short dst_y, int easy, bool
unit->stop_walking(bl, STOPWALKING_FLAG_FIXPOS);
unit->stop_attack(bl);
- if( checkpath && (map->getcell(bl->m,dst_x,dst_y,CELL_CHKNOPASS) || !path->search(NULL,bl,bl->m,bl->x,bl->y,dst_x,dst_y,easy,CELL_CHKNOREACH)) )
+ if (checkpath && (map->getcell(bl->m, bl, dst_x, dst_y, CELL_CHKNOPASS) || !path->search(NULL, bl, bl->m, bl->x, bl->y, dst_x, dst_y, easy, CELL_CHKNOREACH)) )
return 0; // unreachable
ud->to_x = dst_x;
@@ -764,7 +764,7 @@ int unit_movepos(struct block_list *bl, short dst_x, short dst_y, int easy, bool
if(sd) {
if( sd->touching_id )
npc->touchnext_areanpc(sd,false);
- if(map->getcell(bl->m,bl->x,bl->y,CELL_CHKNPC)) {
+ if (map->getcell(bl->m, bl, bl->x, bl->y, CELL_CHKNPC)) {
npc->touch_areanpc(sd,bl->m,bl->x,bl->y);
if (bl->prev == NULL) //Script could have warped char, abort remaining of the function.
return 0;
@@ -866,7 +866,7 @@ int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag)
if(sd->touching_id) {
npc->touchnext_areanpc(sd, false);
}
- if(map->getcell(bl->m, bl->x, bl->y, CELL_CHKNPC)) {
+ if (map->getcell(bl->m, bl, bl->x, bl->y, CELL_CHKNPC)) {
npc->touch_areanpc(sd, bl->m, bl->x, bl->y);
} else {
npc->untouch_areanpc(sd, bl->m, bl->x, bl->y);;
@@ -919,7 +919,7 @@ int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type)
return 2;
}
- } else if (map->getcell(m,x,y,CELL_CHKNOREACH)) {
+ } else if (map->getcell(m, bl, x, y, CELL_CHKNOREACH)) {
//Invalid target cell
ShowWarning("unit_warp: Specified non-walkable target cell: %d (%s) at [%d,%d]\n", m, map->list[m].name, x,y);
@@ -1104,8 +1104,8 @@ int unit_can_move(struct block_list *bl) {
// Icewall walk block special trapped monster mode
if(bl->type == BL_MOB) {
struct mob_data *md = BL_CAST(BL_MOB, bl);
- if(md && ((md->status.mode&MD_BOSS && battle_config.boss_icewall_walk_block == 1 && map->getcell(bl->m,bl->x,bl->y,CELL_CHKICEWALL))
- || (!(md->status.mode&MD_BOSS) && battle_config.mob_icewall_walk_block == 1 && map->getcell(bl->m,bl->x,bl->y,CELL_CHKICEWALL)))) {
+ if (md && ((md->status.mode&MD_BOSS && battle_config.boss_icewall_walk_block == 1 && map->getcell(bl->m, bl, bl->x, bl->y, CELL_CHKICEWALL))
+ || (!(md->status.mode&MD_BOSS) && battle_config.mob_icewall_walk_block == 1 && map->getcell(bl->m, bl, bl->x, bl->y, CELL_CHKICEWALL)))) {
md->walktoxy_fail_count = 1; //Make sure rudeattacked skills are invoked
return 0;
}
@@ -1651,14 +1651,14 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui
* "WHY IS IT HEREE": ice wall cannot be canceled past this point, the client displays the animation even,
* if we cancel it from castend_pos, so it has to be here for it to not display the animation.
**/
- if ( skill_id == WZ_ICEWALL && map->getcell(src->m, skill_x, skill_y, CELL_CHKNOICEWALL) )
+ if (skill_id == WZ_ICEWALL && map->getcell(src->m, src, skill_x, skill_y, CELL_CHKNOICEWALL))
return 0;
}
if (!status->check_skilluse(src, NULL, skill_id, 0))
return 0;
- if( map->getcell(src->m, skill_x, skill_y, CELL_CHKWALL) ) {
+ if (map->getcell(src->m, src, skill_x, skill_y, CELL_CHKWALL)) {
// can't cast ground targeted spells on wall cells
if (sd) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
@@ -1967,10 +1967,10 @@ bool unit_can_reach_bl(struct block_list *bl,struct block_list *tbl, int range,
dx=(dx>0)?1:((dx<0)?-1:0);
dy=(dy>0)?1:((dy<0)?-1:0);
- if (map->getcell(tbl->m,tbl->x-dx,tbl->y-dy,CELL_CHKNOPASS)) {
+ if (map->getcell(tbl->m, bl, tbl->x - dx, tbl->y - dy, CELL_CHKNOPASS)) {
int i;
//Look for a suitable cell to place in.
- for(i=0;i<8 && map->getcell(tbl->m,tbl->x-dirx[i],tbl->y-diry[i],CELL_CHKNOPASS);i++);
+ for (i=0;i<8 && map->getcell(tbl->m, bl, tbl->x - dirx[i], tbl->y - diry[i], CELL_CHKNOPASS); i++);
if (i==8) return false; //No valid cells.
dx = dirx[i];
dy = diry[i];
@@ -2099,7 +2099,7 @@ int unit_attack_timer_sub(struct block_list* src, int tid, int64 tick) {
range = sstatus->rhw.range;
if( (unit->is_walking(target) || ud->state.step_attack)
- && (target->type == BL_PC || !map->getcell(target->m,target->x,target->y,CELL_CHKICEWALL)) )
+ && (target->type == BL_PC || !map->getcell(target->m, src, target->x, target->y, CELL_CHKICEWALL)))
range++; // Extra range when chasing (does not apply to mobs locked in an icewall)
if(sd && !check_distance_client_bl(src,target,range)) {