version 1.7 | | version 1.8 |
---|
| | |
/* | | /* |
* static char *rcsid_weather_c = | | * static char *rcsid_weather_c = |
* "$Id: weather.c,v 1.7 2002/10/29 07:16:14 garbled Exp $"; | | * "$Id: weather.c,v 1.8 2002/10/29 07:49:32 garbled Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
| | |
void temperature_calc(int x, int y, timeofday_t *tod) | | void temperature_calc(int x, int y, timeofday_t *tod) |
{ | | { |
int dist, equator, elev, eq2; | | int dist, equator, elev, n; |
float diff, tdiff; | | float diff, tdiff; |
| | |
equator = (WEATHERMAPTILESX + WEATHERMAPTILESY) / 4; | | equator = (WEATHERMAPTILESX + WEATHERMAPTILESY) / 4; |
eq2 = (WEATHERMAPTILESX + WEATHERMAPTILESY) / 2; | | |
diff = (float)(EQUATOR_BASE_TEMP - POLAR_BASE_TEMP) / (float)equator; | | diff = (float)(EQUATOR_BASE_TEMP - POLAR_BASE_TEMP) / (float)equator; |
tdiff = (float)SEASONAL_ADJUST / ((float)MONTHS_PER_YEAR / 2.0); | | tdiff = (float)SEASONAL_ADJUST / ((float)MONTHS_PER_YEAR / 2.0); |
| | equator *= 2; |
| | n = 0; |
/* we essentially move the equator during the season */ | | /* we essentially move the equator during the season */ |
if (tod->month > (MONTHS_PER_YEAR / 2)) { /* EOY */ | | if (tod->month > (MONTHS_PER_YEAR / 2)) { /* EOY */ |
eq2 -= tod->month * tdiff; | | n -= (tod->month * tdiff); |
} else { | | } else { |
eq2 += (MONTHS_PER_YEAR - tod->month) * tdiff; | | n = (MONTHS_PER_YEAR - tod->month) * tdiff; |
} | | } |
dist = polar_distance(x, y, eq2); | | dist = polar_distance(x-n/2, y-n/2, equator); |
| | |
/* now we have the base temp, unadjusted for time. Time adjustment | | /* now we have the base temp, unadjusted for time. Time adjustment |
is not recorded on the map, rather, it's done JIT. */ | | is not recorded on the map, rather, it's done JIT. */ |