version 1.46 | | version 1.47 |
---|
| | |
/* | | /* |
* static char *rcsid_weather_c = | | * static char *rcsid_weather_c = |
* "$Id: weather.c,v 1.46 2006/06/05 06:28:57 mwedel Exp $"; | | * "$Id: weather.c,v 1.47 2006/08/26 16:09:13 ryo_saeba Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
{ | | { |
int avoid, gotsnow, i, n; | | int avoid, gotsnow, i, n; |
| | |
object *tmp; | | object *tmp, *snow; |
avoid = 0; | | avoid = 0; |
gotsnow = 0; | | gotsnow = 0; |
if (grow) { | | if (grow) { |
for (tmp=GET_MAP_OB(m, x, y), n=0; tmp; tmp = tmp->above, n++) { | | for (tmp=GET_MAP_OB(m, x, y); tmp; tmp = tmp->above) { |
/* look for things like walls, holes, etc */ | | /* look for things like walls, holes, etc */ |
if (n) | | |
if (!QUERY_FLAG (tmp, FLAG_IS_FLOOR) && | | if (!QUERY_FLAG (tmp, FLAG_IS_FLOOR) && |
!(tmp->material & M_ICE || tmp->material & M_LIQUID)) | | !(tmp->material & M_ICE || tmp->material & M_LIQUID)) { |
gotsnow++; | | gotsnow++; |
| | snow = tmp; |
| | } |
for (i=0; growth_avoids[i].name != NULL; i++) { | | for (i=0; growth_avoids[i].name != NULL; i++) { |
/*if (!strcmp(tmp->arch->name, growth_avoids[i].name)) {*/ | | |
if (tmp->arch== growth_avoids[i].what) { | | if (tmp->arch== growth_avoids[i].what) { |
avoid++; | | avoid++; |
break; | | break; |
| | |
avoid++; | | avoid++; |
break; | | break; |
} | | } |
if (avoid) | | if (avoid && gotsnow) |
break; | | break; |
} | | } |
} else { | | } else { |
| | |
for (i=0; weather_avoids[i].name != NULL; i++) { | | for (i=0; weather_avoids[i].name != NULL; i++) { |
/*if (!strcmp(tmp->arch->name, weather_avoids[i].name)) {*/ | | /*if (!strcmp(tmp->arch->name, weather_avoids[i].name)) {*/ |
if (tmp->arch == weather_avoids[i].what) { | | if (tmp->arch == weather_avoids[i].what) { |
if (weather_avoids[i].snow == 1) | | if (weather_avoids[i].snow == 1) { |
gotsnow++; | | gotsnow++; |
else | | snow = tmp; |
| | } else { |
avoid++; | | avoid++; |
| | } |
break; | | break; |
} | | } |
} | | } |
if (avoid || gotsnow) | | if (avoid && gotsnow) |
break; | | break; |
} | | } |
} | | } |
*gs = gotsnow; | | *gs = gotsnow; |
*av = avoid; | | *av = avoid; |
return tmp; | | |
| | return snow; |
} | | } |
| | |
/* Temperature is used in a lot of weather function. | | /* Temperature is used in a lot of weather function. |