Fixed areawarp cell check
The script command areawarp has been checking the wrong target map for ages. It has been checking the mapindex rather than the mapid and therefore returned a wrong result.
This commit is contained in:
parent
d7e5f1b5d9
commit
ac2ba09415
@ -5501,6 +5501,9 @@ static int buildin_areawarp_sub(struct block_list *bl,va_list ap)
|
|||||||
pc_randomwarp((TBL_PC *)bl,CLR_TELEPORT);
|
pc_randomwarp((TBL_PC *)bl,CLR_TELEPORT);
|
||||||
else if(x3 && y3) {
|
else if(x3 && y3) {
|
||||||
int max, tx, ty, j = 0;
|
int max, tx, ty, j = 0;
|
||||||
|
int16 m;
|
||||||
|
|
||||||
|
m = map_mapindex2mapid(index);
|
||||||
|
|
||||||
// choose a suitable max number of attempts
|
// choose a suitable max number of attempts
|
||||||
if( (max = (y3-y2+1)*(x3-x2+1)*3) > 1000 )
|
if( (max = (y3-y2+1)*(x3-x2+1)*3) > 1000 )
|
||||||
@ -5511,7 +5514,7 @@ static int buildin_areawarp_sub(struct block_list *bl,va_list ap)
|
|||||||
tx = rnd()%(x3-x2+1)+x2;
|
tx = rnd()%(x3-x2+1)+x2;
|
||||||
ty = rnd()%(y3-y2+1)+y2;
|
ty = rnd()%(y3-y2+1)+y2;
|
||||||
j++;
|
j++;
|
||||||
} while( map_getcell(index,tx,ty,CELL_CHKNOPASS) && j < max );
|
} while( map_getcell(m,tx,ty,CELL_CHKNOPASS) && j < max );
|
||||||
|
|
||||||
pc_setpos((TBL_PC *)bl,index,tx,ty,CLR_OUTSIGHT);
|
pc_setpos((TBL_PC *)bl,index,tx,ty,CLR_OUTSIGHT);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user