| version 1.13 | | version 1.14 |
|---|
| | |
| /* | | /* |
| * static char *rcsid_weather_c = | | * static char *rcsid_weather_c = |
| * "$Id: weather.c,v 1.13 2002/11/08 08:54:07 garbled Exp $"; | | * "$Id: weather.c,v 1.14 2002/11/26 10:00:08 garbled Exp $"; |
| */ | | */ |
| /* | | /* |
| CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
| 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 1, 1, | | 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 1, 1, |
| 1, 1, 1, 1, 1, 1}; | | 1, 1, 1, 1, 1, 1}; |
| | | |
| | | /* |
| | | * The table below is used to set which tiles the weather will avoid |
| | | * processing. This keeps it from putting snow on snow, and putting snow |
| | | * on the ocean, and other things like that. |
| | | */ |
| | | |
| | | weather_avoids_t weather_avoids[] = { |
| | | {"snow", 1}, |
| | | {"snow2", 1}, |
| | | {"snow4", 1}, |
| | | {"snow5", 1}, |
| | | {"rain1", 1}, |
| | | {"rain2", 1}, |
| | | {"rain3", 1}, |
| | | {"rain4", 1}, |
| | | {"rain5", 1}, |
| | | {"drifts", 0}, |
| | | {"cforest1", 0}, |
| | | {"sea", 0}, |
| | | {"sea1", 0}, |
| | | {"deep_sea", 0}, |
| | | {"shallow_sea", 0}, |
| | | {NULL, 0} |
| | | }; |
| | | |
| void set_darkness_map(mapstruct *m) | | void set_darkness_map(mapstruct *m) |
| { | | { |
| int i; | | int i; |
| | |
| if (season_timechange[tod->season][tod->hour] == 0) return; | | if (season_timechange[tod->season][tod->hour] == 0) return; |
| | | |
| for(m=first_map;m!=NULL;m=m->next) { | | for(m=first_map;m!=NULL;m=m->next) { |
| #ifndef MAP_RESET | | |
| if (m->in_memory == MAP_SWAPPED) | | |
| continue; | | |
| #endif | | |
| if (!m->outdoor) | | if (!m->outdoor) |
| continue; | | continue; |
| change_map_light(m, season_timechange[tod->season][tod->hour]); | | change_map_light(m, season_timechange[tod->season][tod->hour]); |
| | |
| | | |
| object *avoid_weather(int *av, mapstruct *m, int x, int y, int *gs) | | object *avoid_weather(int *av, mapstruct *m, int x, int y, int *gs) |
| { | | { |
| int avoid, gotsnow; | | int avoid, gotsnow, i; |
| | | |
| object *tmp; | | object *tmp; |
| avoid = 0; | | avoid = 0; |
| gotsnow = 0; | | gotsnow = 0; |
| for (tmp=GET_MAP_OB(m, x, y); tmp; tmp = tmp->above) { | | for (tmp=GET_MAP_OB(m, x, y); tmp; tmp = tmp->above) { |
| if (!strcmp(tmp->arch->name, "snow")) { | | for (i=0; weather_avoids[i].name != NULL; i++) { |
| gotsnow++; | | if (!strcmp(tmp->arch->name, weather_avoids[i].name)) { |
| break; | | if (weather_avoids[i].snow == 1) |
| } else if (!strcmp(tmp->arch->name, "snow2")) { | | |
| gotsnow++; | | |
| break; | | |
| } else if (!strcmp(tmp->arch->name, "snow4")) { | | |
| gotsnow++; | | |
| break; | | |
| } else if (!strcmp(tmp->arch->name, "rain1")) { | | |
| gotsnow++; | | |
| break; | | |
| } else if (!strcmp(tmp->arch->name, "rain2")) { | | |
| gotsnow++; | | |
| break; | | |
| } else if (!strcmp(tmp->arch->name, "rain3")) { | | |
| gotsnow++; | | |
| break; | | |
| } else if (!strcmp(tmp->arch->name, "rain4")) { | | |
| gotsnow++; | | gotsnow++; |
| | | else |
| | | avoid++; |
| break; | | break; |
| } else if (!strcmp(tmp->arch->name, "rain5")) { | | } |
| gotsnow++; | | } |
| | | if (avoid || gotsnow) |
| break; | | break; |
| } else if (!strcmp(tmp->name, "drifts")) | | |
| avoid++; | | |
| else if (!strcmp(tmp->arch->name, "cforest1")) | | |
| avoid++; | | |
| else if (!strcmp(tmp->name, "sea")) | | |
| avoid++; | | |
| else if (!strcmp(tmp->name, "sea1")) | | |
| avoid++; | | |
| else if (!strcmp(tmp->name, "deep_sea")) | | |
| avoid++; | | |
| else if (!strcmp(tmp->name, "shallow_sea")) | | |
| avoid++; | | |
| } | | } |
| *gs = gotsnow; | | *gs = gotsnow; |
| *av = avoid; | | *av = avoid; |