version 1.137 | | version 1.138 |
---|
| | |
/* | | /* |
* static char *rcsid_player_c = | | * static char *rcsid_player_c = |
* "$Id: player.c,v 1.137 2003/10/17 17:24:53 ryo_saeba Exp $"; | | * "$Id: player.c,v 1.138 2003/11/02 04:17:00 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
| | |
int stand_near_hostile( object *who ) { | | int stand_near_hostile( object *who ) { |
object *tmp=NULL; | | object *tmp=NULL; |
int i,friendly=0,player=0; | | int i,friendly=0,player=0, mflags; |
| | mapstruct *m; |
| | sint16 x,y; |
| | |
if(!who) return 0; | | if(!who) return 0; |
| | |
| | |
| | |
/* search adjacent squares */ | | /* search adjacent squares */ |
for(i=1;i<9;i++) { | | for(i=1;i<9;i++) { |
if (out_of_map(who->map, who->x+freearr_x[i],who->y+freearr_y[i])) continue; | | x = who->x+freearr_x[i]; |
for(tmp=get_map_ob(who->map,who->x+freearr_x[i],who->y+freearr_y[i]); | | y = who->y+freearr_y[i]; |
tmp;tmp=tmp->above) { | | m = who->map; |
| | mflags = get_map_flags(m, &m, x, y, &x, &y); |
| | /* space must be blocked if there is a monster. If not |
| | * blocked, don't need to check this space. |
| | */ |
| | if (mflags & P_OUT_OF_MAP || !(mflags & P_BLOCKED)) continue; |
| | |
| | for(tmp=get_map_ob(m,x,y);tmp;tmp=tmp->above) { |
if((player||friendly) | | if((player||friendly) |
&&QUERY_FLAG(tmp,FLAG_MONSTER)&&!QUERY_FLAG(tmp,FLAG_UNAGGRESSIVE)) | | &&QUERY_FLAG(tmp,FLAG_MONSTER)&&!QUERY_FLAG(tmp,FLAG_UNAGGRESSIVE)) |
return 1; | | return 1; |
else if(tmp->type==PLAYER) return 1; | | else if(tmp->type==PLAYER) return 1; |
} | | } |
} | | } |
| | |
return 0; | | return 0; |
} | | } |
| | |