version 1.18 | | version 1.19 |
---|
| | |
/* | | /* |
* static char *rcsid_weather_c = | | * static char *rcsid_weather_c = |
* "$Id: weather.c,v 1.18 2002/12/09 03:52:46 garbled Exp $"; | | * "$Id: weather.c,v 1.19 2002/12/09 04:55:38 garbled Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
} | | } |
for (x=0; x < WEATHERMAPTILESX; x++) { | | for (x=0; x < WEATHERMAPTILESX; x++) { |
for (y=0; y < WEATHERMAPTILESY; y++) { | | for (y=0; y < WEATHERMAPTILESY; y++) { |
fscanf(fp, "%d ", &weathermap[x][y].pressure); | | fscanf(fp, "%hd ", &weathermap[x][y].pressure); |
if (weathermap[x][y].pressure < 960 || | | if (weathermap[x][y].pressure < 960 || |
weathermap[x][y].pressure > 1040) | | weathermap[x][y].pressure > 1040) |
weathermap[x][y].pressure = rndm(960, 1040); | | weathermap[x][y].pressure = rndm(960, 1040); |
| | |
} | | } |
for (x=0; x < WEATHERMAPTILESX; x++) { | | for (x=0; x < WEATHERMAPTILESX; x++) { |
for (y=0; y < WEATHERMAPTILESY; y++) { | | for (y=0; y < WEATHERMAPTILESY; y++) { |
fscanf(fp, "%d ", &weathermap[x][y].winddir); | | fscanf(fp, "%c ", &weathermap[x][y].winddir); |
if (weathermap[x][y].winddir < 1 || | | if (weathermap[x][y].winddir < 1 || |
weathermap[x][y].winddir > 8) | | weathermap[x][y].winddir > 8) |
weathermap[x][y].winddir = rndm(1, 8); | | weathermap[x][y].winddir = rndm(1, 8); |
| | |
} | | } |
for (x=0; x < WEATHERMAPTILESX; x++) { | | for (x=0; x < WEATHERMAPTILESX; x++) { |
for (y=0; y < WEATHERMAPTILESY; y++) { | | for (y=0; y < WEATHERMAPTILESY; y++) { |
fscanf(fp, "%d ", &weathermap[x][y].windspeed); | | fscanf(fp, "%c ", &weathermap[x][y].windspeed); |
if (weathermap[x][y].windspeed < 0 || | | if (weathermap[x][y].windspeed < 0 || |
weathermap[x][y].windspeed > 120) | | weathermap[x][y].windspeed > 120) |
weathermap[x][y].windspeed = rndm(1, 30); | | weathermap[x][y].windspeed = rndm(1, 30); |
| | |
} | | } |
for (x=0; x < WEATHERMAPTILESX; x++) { | | for (x=0; x < WEATHERMAPTILESX; x++) { |
for (y=0; y < WEATHERMAPTILESY; y++) { | | for (y=0; y < WEATHERMAPTILESY; y++) { |
fscanf(fp, "%d ", &weathermap[x][y].humid); | | fscanf(fp, "%c ", &weathermap[x][y].humid); |
if (weathermap[x][y].humid < 0 || | | if (weathermap[x][y].humid < 0 || |
weathermap[x][y].humid > 100) | | weathermap[x][y].humid > 100) |
weathermap[x][y].humid = rndm(0, 100); | | weathermap[x][y].humid = rndm(0, 100); |
| | |
} | | } |
for (x=0; x < WEATHERMAPTILESX; x++) { | | for (x=0; x < WEATHERMAPTILESX; x++) { |
for (y=0; y < WEATHERMAPTILESY; y++) { | | for (y=0; y < WEATHERMAPTILESY; y++) { |
fscanf(fp, "%d ", &weathermap[x][y].water); | | fscanf(fp, "%c ", &weathermap[x][y].water); |
if (weathermap[x][y].water > 100) | | if (weathermap[x][y].water > 100) |
weathermap[x][y].water = rndm(0, 100); | | weathermap[x][y].water = rndm(0, 100); |
} | | } |
| | |
| | |
void init_humid_elev() | | void init_humid_elev() |
{ | | { |
int x, y, tx, ty, nx, ny, ax, ay, j, k; | | int x, y, tx, ty, nx, ny, ax, ay, j; |
int spwtx, spwty, dir; | | int spwtx, spwty; |
char *mapname; | | char *mapname; |
long int elev; | | long int elev; |
int water, space; | | int water, space; |
| | |
} | | } |
for (x=0; x < WEATHERMAPTILESX; x++) { | | for (x=0; x < WEATHERMAPTILESX; x++) { |
for (y=0; y < WEATHERMAPTILESY; y++) { | | for (y=0; y < WEATHERMAPTILESY; y++) { |
fscanf(fp, "%d ", &weathermap[x][y].temp); | | fscanf(fp, "%hd ", &weathermap[x][y].temp); |
if (weathermap[x][y].temp < -30 || | | if (weathermap[x][y].temp < -30 || |
weathermap[x][y].temp > 60) | | weathermap[x][y].temp > 60) |
weathermap[x][y].temp = rndm(-10, 40); | | weathermap[x][y].temp = rndm(-10, 40); |
| | |
| | |
void init_weather() | | void init_weather() |
{ | | { |
int x, y, tx, ty; | | int y, tx, ty; |
int i, j; | | |
int water; | | |
long int tmp; | | |
char filename[MAX_BUF]; | | char filename[MAX_BUF]; |
FILE *fp; | | FILE *fp; |
mapstruct *m; | | |
| | |
/* all this stuff needs to be set, otherwise this function will cause | | /* all this stuff needs to be set, otherwise this function will cause |
* chaos and destruction. | | * chaos and destruction. |
| | |
/* we look up through two tiles for a matching tile */ | | /* we look up through two tiles for a matching tile */ |
if (weather_grow[i].tile != NULL) { | | if (weather_grow[i].tile != NULL) { |
if (strcmp(GET_MAP_OB(m, x, y)->arch->name, | | if (strcmp(GET_MAP_OB(m, x, y)->arch->name, |
weather_grow[i].tile) != 0) | | weather_grow[i].tile) != 0) { |
if (GET_MAP_OB(m, x, y)->above != NULL) { | | if (GET_MAP_OB(m, x, y)->above != NULL) { |
if (strcmp(GET_MAP_OB(m, x, y)->above->arch->name, | | if (strcmp(GET_MAP_OB(m, x, y)->above->arch->name, |
weather_grow[i].tile) != 0) | | weather_grow[i].tile) != 0) |
| | |
} else | | } else |
continue; | | continue; |
} | | } |
| | } |
if ((float)weathermap[wx][wy].rainfall/days < weather_grow[i].rfmin || | | if ((float)weathermap[wx][wy].rainfall/days < weather_grow[i].rfmin || |
(float)weathermap[wx][wy].rainfall/days > weather_grow[i].rfmax) | | (float)weathermap[wx][wy].rainfall/days > weather_grow[i].rfmax) |
continue; | | continue; |
| | |
void feather_map(mapstruct *m, int wx, int wy, char *filename) | | void feather_map(mapstruct *m, int wx, int wy, char *filename) |
{ | | { |
int x, y, i, nx, ny, j; | | int x, y, i, nx, ny, j; |
int avoid, two, temp, sky, gotsnow, found, nodstk; | | int avoid, two, gotsnow, nodstk; |
object *ob, *tmp, *oldsnow, *topfloor, *ntmp, *ntopfloor; | | object *ob, *tmp, *oldsnow, *topfloor, *ntmp, *ntopfloor; |
char *doublestack, *doublestack2; | | |
archetype *at; | | archetype *at; |
| | |
for (x=0; x < settings.worldmaptilesizex; x++) { | | for (x=0; x < settings.worldmaptilesizex; x++) { |