summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 376efb313..d314d2e30 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -3822,7 +3822,7 @@ int pc_steal_coin(struct map_session_data *sd,struct block_list *bl)
int pc_setpos(struct map_session_data *sd,char *mapname_org,int x,int y,int clrtype)
{
char mapname[24];
- int m=0,c=0,disguise=0;
+ int m=0,disguise=0;
nullpo_retr(0, sd);
@@ -3935,7 +3935,7 @@ int pc_setpos(struct map_session_data *sd,char *mapname_org,int x,int y,int clrt
if(x <0 || x >= map[m].xs || y <0 || y >= map[m].ys)
x=y=0;
- if((x==0 && y==0) || (c=read_gat(m,x,y))==1 || c==5){
+ if((x==0 && y==0) || map_getcell(m,x,y,CELL_CHKNOPASS)){
if(x||y) {
if(battle_config.error_log)
printf("stacked (%d,%d)\n",x,y);
@@ -3943,7 +3943,7 @@ int pc_setpos(struct map_session_data *sd,char *mapname_org,int x,int y,int clrt
do {
x=rand()%(map[m].xs-2)+1;
y=rand()%(map[m].ys-2)+1;
- } while((c=read_gat(m,x,y))==1 || c==5);
+ } while(map_getcell(m,x,y,CELL_CHKNOPASS));
}
if(sd->mapname[0] && sd->bl.prev != NULL){
@@ -4011,7 +4011,7 @@ int pc_setpos(struct map_session_data *sd,char *mapname_org,int x,int y,int clrt
*------------------------------------------
*/
int pc_randomwarp(struct map_session_data *sd, int type) {
- int x,y,c,i=0;
+ int x,y,i=0;
int m;
nullpo_retr(0, sd);
@@ -4024,7 +4024,7 @@ int pc_randomwarp(struct map_session_data *sd, int type) {
do{
x=rand()%(map[m].xs-2)+1;
y=rand()%(map[m].ys-2)+1;
- } while (((c=read_gat(m,x,y)) == 1 || c == 5) && (i++) < 1000);
+ }while(map_getcell(m,x,y,CELL_CHKNOPASS) && (i++)<1000 );
if (i < 1000)
pc_setpos(sd,map[m].name,x,y,type);
@@ -4129,7 +4129,7 @@ static int calc_next_walk_step(struct map_session_data *sd)
static int pc_walk(int tid,unsigned int tick,int id,int data)
{
struct map_session_data *sd;
- int i,ctype;
+ int i;
int moveblock;
int x,y,dx,dy;
@@ -4162,16 +4162,14 @@ static int pc_walk(int tid,unsigned int tick,int id,int data)
x = sd->bl.x;
y = sd->bl.y;
- ctype = map_getcell(sd->bl.m,x,y);
- if(ctype == 1 || ctype == 5) {
+ if(map_getcell(sd->bl.m,x,y,CELL_CHKNOPASS)) {
pc_stop_walking(sd,1);
return 0;
}
sd->dir=sd->head_dir=sd->walkpath.path[sd->walkpath.path_pos];
dx = dirx[(int)sd->dir];
dy = diry[(int)sd->dir];
- ctype = map_getcell(sd->bl.m,x+dx,y+dy);
- if(ctype == 1 || ctype == 5) {
+ if(map_getcell(sd->bl.m,x,y,CELL_CHKNOPASS)) {
pc_walktoxy_sub(sd);
return 0;
}
@@ -4252,7 +4250,7 @@ static int pc_walk(int tid,unsigned int tick,int id,int data)
skill_unit_move(&sd->bl,tick,1); // スキルユニットの?査
- if(map_getcell(sd->bl.m,x,y)&0x80)
+ if(map_getcell(sd->bl.m,x,y,CELL_CHKTOUCH))
npc_touch_areanpc(sd,sd->bl.m,x,y);
else
sd->areanpc_id=0;
@@ -4378,15 +4376,14 @@ int pc_randomwalk(struct map_session_data *sd,int tick)
nullpo_retr(0, sd);
if(DIFF_TICK(sd->next_walktime,tick)<0){
- int i,x,y,c,d;
+ int i,x,y,d;
d = rand()%7+5;
for(i=0;i<retrycount;i++){ // Search of a movable place
int r=rand();
x=sd->bl.x+r%(d*2+1)-d;
y=sd->bl.y+r/(d*2+1)%(d*2+1)-d;
- if((c=map_getcell(sd->bl.m,x,y))!=1 && c!=5 && pc_walktoxy(sd,x,y)==0){
+ if((map_getcell(sd->bl.m,x,y,CELL_CHKPASS)) && pc_walktoxy(sd,x,y)==0)
break;
- }
}
// Working on this part later [celest]
/*for(i=c=0;i<sd->walkpath.path_len;i++){ // The next walk start time is calculated.
@@ -4450,7 +4447,7 @@ int pc_movepos(struct map_session_data *sd,int dst_x,int dst_y)
skill_unit_move(&sd->bl,gettick(),dist+7); // スキルユニットの?査
- if(map_getcell(sd->bl.m,sd->bl.x,sd->bl.y)&0x80)
+ if(map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKTOUCH))
npc_touch_areanpc(sd,sd->bl.m,sd->bl.x,sd->bl.y);
else
sd->areanpc_id=0;