From 1fedfe101b0a990e24708ead1c35b451ef91c9fb Mon Sep 17 00:00:00 2001 From: csnv Date: Sun, 17 Mar 2024 02:48:58 +0100 Subject: [PATCH] Added check that prevents teleporting into portals --- src/map/pc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/map/pc.c b/src/map/pc.c index 26499fdff..6324b8fb8 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -6099,7 +6099,7 @@ static int pc_setpos(struct map_session_data *sd, unsigned short map_index, int do { x = rnd() % (map->list[map_id].xs - 2) + 1; y = rnd() % (map->list[map_id].ys - 2) + 1; - } while(map->getcell(map_id, &sd->bl, x, y, CELL_CHKNOPASS) != 0); + } while(map->getcell(map_id, &sd->bl, x, y, CELL_CHKNOPASS) != 0 || npc->check_areanpc(1, sd->bl.m, x, y, 2)); } if (sd->state.vending != 0 && map->getcell(map_id, &sd->bl, x, y, CELL_CHKNOVENDING) != 0) { @@ -6187,7 +6187,7 @@ static int pc_randomwarp(struct map_session_data *sd, enum clr_type type) do { x=rnd()%(map->list[m].xs-2)+1; y=rnd()%(map->list[m].ys-2)+1; - } while (map->getcell(m, &sd->bl, x, y, CELL_CHKNOPASS) && (i++) < 1000 ); + } while ((map->getcell(m, &sd->bl, x, y, CELL_CHKNOPASS) || npc->check_areanpc(1, sd->bl.m, x, y, 2)) && (i++) < 1000); if (i < 1000) return pc->setpos(sd,map_id2index(sd->bl.m),x,y,type);