version 1.22 | | version 1.23 |
---|
| | |
/* | | /* |
* static char *rcsid_disease_c = | | * static char *rcsid_disease_c = |
* "$Id: disease.c,v 1.22 2002/09/15 03:15:17 mwedel Exp $"; | | * "$Id: disease.c,v 1.23 2003/01/08 08:39:20 mwedel Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
| | |
/* searches around for more victims to infect */ | | /* searches around for more victims to infect */ |
int check_infection(object *disease) { | | int check_infection(object *disease) { |
int x,y,i,j,range; | | int x,y,range, mflags;; |
struct mapdef *map; | | struct mapdef *map; |
object *tmp; | | object *tmp; |
| | sint16 i,j; |
| | |
range = abs(disease->magic); | | range = abs(disease->magic); |
if(disease->env) { x = disease->env->x; y = disease->env->y;map=disease->env->map;} | | if(disease->env) { |
else { x = disease->x; y = disease->y; map = disease->map; }; | | x = disease->env->x; |
| | y = disease->env->y; |
| | map=disease->env->map; |
| | } |
| | else { |
| | x = disease->x; |
| | y = disease->y; |
| | map = disease->map; |
| | } |
| | |
if(map == NULL) return 0; | | if(map == NULL) return 0; |
for(i=x-range;i<x+range;i++) { | | for(i=x-range;i<x+range;i++) { |
for(j=y-range;j<y+range;j++) { | | for(j=y-range;j<y+range;j++) { |
if(!out_of_map(map,i,j)) | | mflags = get_map_flags(map,&map, i,j, &i, &j); |
| | if (!(mflags & P_OUT_OF_MAP) && (mflags & P_IS_ALIVE)) { |
for(tmp=get_map_ob(map,i,j);tmp;tmp=tmp->above) { | | for(tmp=get_map_ob(map,i,j);tmp;tmp=tmp->above) { |
infect_object(tmp,disease,0); | | infect_object(tmp,disease,0); |
} | | } |
} | | } |
} | | } |
| | } |
return 1; | | return 1; |
} | | } |
| | |