1 | /* |
1 | /* |
2 | * static char *rcsid_weather_c = |
2 | * static char *rcsid_weather_c = |
3 | * "$Id: weather.C,v 1.3 2006/08/29 08:01:38 root Exp $"; |
3 | * "$Id: weather.C,v 1.4 2006/09/08 04:52:20 pippijn Exp $"; |
4 | */ |
4 | */ |
5 | /* |
5 | /* |
6 | CrossFire, A Multiplayer game for X-windows |
6 | CrossFire, A Multiplayer game for X-windows |
7 | |
7 | |
8 | Copyright (C) 2002 Tim Rightnour |
8 | Copyright (C) 2002 Tim Rightnour |
… | |
… | |
70 | static void calculate_temperature(mapstruct *m, int wx, int wy); |
70 | static void calculate_temperature(mapstruct *m, int wx, int wy); |
71 | static void let_it_snow(mapstruct *m, int wx, int wy); |
71 | static void let_it_snow(mapstruct *m, int wx, int wy); |
72 | static void singing_in_the_rain(mapstruct *m, int wx, int wy); |
72 | static void singing_in_the_rain(mapstruct *m, int wx, int wy); |
73 | static void plant_a_garden(mapstruct *m, int wx, int wy); |
73 | static void plant_a_garden(mapstruct *m, int wx, int wy); |
74 | static void change_the_world(mapstruct *m, int wx, int wy); |
74 | static void change_the_world(mapstruct *m, int wx, int wy); |
75 | static void feather_map(mapstruct *m, int wx, int wy); |
75 | //static void feather_map(mapstruct *m, int wx, int wy); |
76 | static const char *weathermap_to_worldmap_corner(int wx, int wy, int *x, int *y, int dir); |
76 | static const char *weathermap_to_worldmap_corner(int wx, int wy, int *x, int *y, int dir); |
77 | static int polar_distance(int x, int y, int equator); |
77 | static int polar_distance(int x, int y, int equator); |
78 | static void update_humid(void); |
78 | static void update_humid(void); |
79 | static int humid_tile(int x, int y); |
79 | static int humid_tile(int x, int y); |
80 | static void temperature_calc(int x, int y, const timeofday_t *tod); |
80 | static void temperature_calc(int x, int y, const timeofday_t *tod); |
… | |
… | |
1013 | if (m == NULL) |
1013 | if (m == NULL) |
1014 | continue; |
1014 | continue; |
1015 | m = load_overlay_map(mapname, m); |
1015 | m = load_overlay_map(mapname, m); |
1016 | if (m == NULL) |
1016 | if (m == NULL) |
1017 | continue; |
1017 | continue; |
1018 | for (nx=0,ax=tx; (nx < spwtx && ax < settings.worldmaptilesizex && |
1018 | for (nx = 0, ax = tx; ( nx < spwtx && (uint32) ax < settings.worldmaptilesizex && |
1019 | space < spwtx*spwty); ax++,nx++) { |
1019 | space < spwtx * spwty); ax++, nx++) { |
1020 | for (ny=0,ay=ty; (ny < spwty && ay < settings.worldmaptilesizey && |
1020 | for (ny=0,ay=ty; (ny < spwty && (uint32) ay < settings.worldmaptilesizey && |
1021 | space < spwtx*spwty); |
1021 | space < spwtx*spwty); |
1022 | ay++,ny++,space++) |
1022 | ay++,ny++,space++) |
1023 | if(GET_MAP_OB(m, ax, ay)){ |
1023 | if(GET_MAP_OB(m, ax, ay)){ |
1024 | if (QUERY_FLAG(GET_MAP_OB(m, ax, ay), FLAG_IS_WATER)) |
1024 | if (QUERY_FLAG(GET_MAP_OB(m, ax, ay), FLAG_IS_WATER)) |
1025 | water++; |
1025 | water++; |
… | |
… | |
1035 | continue; |
1035 | continue; |
1036 | m = load_overlay_map(mapname, m); |
1036 | m = load_overlay_map(mapname, m); |
1037 | if (m == NULL) |
1037 | if (m == NULL) |
1038 | continue; |
1038 | continue; |
1039 | j = ny; |
1039 | j = ny; |
1040 | for (nx=0,ax=tx; (nx < spwtx && ax < settings.worldmaptilesizex && |
1040 | for (nx = 0, ax = tx; (nx < spwtx && (uint32) ax < settings.worldmaptilesizex && |
1041 | space < spwtx*spwty); ax++,nx++) { |
1041 | space < spwtx * spwty); ax++, nx++) { |
1042 | for (ny=j,ay=MAX(0, ty - (spwty-1)); (ny < spwty && ay <= ty && |
1042 | for (ny=j,ay=MAX(0, ty - (spwty-1)); (ny < spwty && ay <= ty && |
1043 | space < spwtx*spwty); |
1043 | space < spwtx * spwty); |
1044 | space++,ay++,ny++) |
1044 | space++,ay++,ny++) |
1045 | if(GET_MAP_OB(m, ax, ay)){ |
1045 | if(GET_MAP_OB(m, ax, ay)){ |
1046 | if (QUERY_FLAG(GET_MAP_OB(m, ax, ay), FLAG_IS_WATER)) |
1046 | if (QUERY_FLAG(GET_MAP_OB(m, ax, ay), FLAG_IS_WATER)) |
1047 | water++; |
1047 | water++; |
1048 | elev += GET_MAP_OB(m, ax, ay)->elevation; |
1048 | elev += GET_MAP_OB(m, ax, ay)->elevation; |
… | |
… | |
1058 | m = load_overlay_map(mapname, m); |
1058 | m = load_overlay_map(mapname, m); |
1059 | if (m == NULL) |
1059 | if (m == NULL) |
1060 | continue; |
1060 | continue; |
1061 | for (ax=MAX(0, tx - (spwtx-1)); (nx < spwtx && ax < tx && |
1061 | for (ax=MAX(0, tx - (spwtx-1)); (nx < spwtx && ax < tx && |
1062 | space < spwtx*spwty); ax++,nx++) { |
1062 | space < spwtx*spwty); ax++,nx++) { |
1063 | for (ny=0,ay=ty; (ny < spwty && ay < settings.worldmaptilesizey && |
1063 | for (ny = 0, ay = ty; (ny < spwty && (uint32) ay < settings.worldmaptilesizey && |
1064 | space < spwtx*spwty); |
1064 | space < spwtx*spwty); |
1065 | ay++,ny++,space++) |
1065 | ay++,ny++,space++) |
1066 | if(GET_MAP_OB(m, ax, ay)){ |
1066 | if(GET_MAP_OB(m, ax, ay)){ |
1067 | if (QUERY_FLAG(GET_MAP_OB(m, ax, ay), FLAG_IS_WATER)) |
1067 | if (QUERY_FLAG(GET_MAP_OB(m, ax, ay), FLAG_IS_WATER)) |
1068 | water++; |
1068 | water++; |
… | |
… | |
1324 | return; |
1324 | return; |
1325 | } |
1325 | } |
1326 | fscanf(fp, "%d %d", &wmperformstartx, &wmperformstarty); |
1326 | fscanf(fp, "%d %d", &wmperformstartx, &wmperformstarty); |
1327 | LOG(llevDebug, "curposx=%d curposy=%d\n", wmperformstartx, wmperformstarty); |
1327 | LOG(llevDebug, "curposx=%d curposy=%d\n", wmperformstartx, wmperformstarty); |
1328 | fclose(fp); |
1328 | fclose(fp); |
1329 | if (wmperformstartx > settings.worldmaptilesx) |
1329 | if ((uint32) wmperformstartx > settings.worldmaptilesx) |
1330 | wmperformstartx = -1; |
1330 | wmperformstartx = -1; |
1331 | if (wmperformstarty > settings.worldmaptilesy) |
1331 | if ((uint32) wmperformstarty > settings.worldmaptilesy) |
1332 | wmperformstarty = 0; |
1332 | wmperformstarty = 0; |
1333 | } |
1333 | } |
1334 | |
1334 | |
1335 | /* |
1335 | /* |
1336 | * This routine slowly loads the world, patches it up due to the weather, |
1336 | * This routine slowly loads the world, patches it up due to the weather, |
… | |
… | |
1349 | |
1349 | |
1350 | if (!settings.dynamiclevel) |
1350 | if (!settings.dynamiclevel) |
1351 | return; |
1351 | return; |
1352 | |
1352 | |
1353 | /* move right to left, top to bottom */ |
1353 | /* move right to left, top to bottom */ |
1354 | if (wmperformstartx+1 == settings.worldmaptilesx) { |
1354 | if ((uint32) wmperformstartx + 1 == settings.worldmaptilesx) { |
1355 | wmperformstartx = 0; |
1355 | wmperformstartx = 0; |
1356 | wmperformstarty++; |
1356 | wmperformstarty++; |
1357 | } else |
1357 | } else |
1358 | wmperformstartx++; |
1358 | wmperformstartx++; |
1359 | if (wmperformstarty == settings.worldmaptilesy) |
1359 | if ((uint32) wmperformstarty == settings.worldmaptilesy) |
1360 | wmperformstartx = wmperformstarty = 0; |
1360 | wmperformstartx = wmperformstarty = 0; |
1361 | |
1361 | |
1362 | sprintf(filename, "world/world_%d_%d", |
1362 | sprintf(filename, "world/world_%d_%d", |
1363 | wmperformstartx+settings.worldmapstartx, |
1363 | wmperformstartx + settings.worldmapstartx, |
1364 | wmperformstarty+settings.worldmapstarty); |
1364 | wmperformstarty + settings.worldmapstarty); |
1365 | |
1365 | |
1366 | m = ready_map_name(filename, 0); |
1366 | m = ready_map_name(filename, 0); |
1367 | if (m == NULL) |
1367 | if (m == NULL) |
1368 | return; /* hrmm */ |
1368 | return; /* hrmm */ |
1369 | |
1369 | |
… | |
… | |
1495 | |
1495 | |
1496 | /* Temperature is used in a lot of weather function. |
1496 | /* Temperature is used in a lot of weather function. |
1497 | * This need to be precalculated before used. |
1497 | * This need to be precalculated before used. |
1498 | */ |
1498 | */ |
1499 | static void calculate_temperature(mapstruct *m, int wx, int wy){ |
1499 | static void calculate_temperature(mapstruct *m, int wx, int wy){ |
1500 | int x,y; |
1500 | uint32 x, y; |
1501 | for (x=0; x < settings.worldmaptilesizex; x++) { |
1501 | for (x = 0; x < settings.worldmaptilesizex; x++) { |
1502 | for (y=0; y < settings.worldmaptilesizey; y++) { |
1502 | for (y=0; y < settings.worldmaptilesizey; y++) { |
1503 | weathermap[wx][wy].realtemp=real_world_temperature(x, y, m); |
1503 | weathermap[wx][wy].realtemp=real_world_temperature(x, y, m); |
1504 | } |
1504 | } |
1505 | } |
1505 | } |
1506 | } |
1506 | } |
… | |
… | |
1513 | */ |
1513 | */ |
1514 | |
1514 | |
1515 | static void let_it_snow(mapstruct *m, int wx, int wy) |
1515 | static void let_it_snow(mapstruct *m, int wx, int wy) |
1516 | { |
1516 | { |
1517 | int x, y, i; |
1517 | int x, y, i; |
1518 | int nx, ny, j, d; |
1518 | uint32 nx, ny, j, d; |
1519 | int avoid, two, temp, sky, gotsnow, found, nodstk; |
1519 | int avoid, two, temp, sky, gotsnow, found, nodstk; |
1520 | const char *doublestack, *doublestack2; |
1520 | const char *doublestack, *doublestack2; |
1521 | object *ob, *tmp, *oldsnow, *topfloor; |
1521 | object *ob, *tmp, *oldsnow, *topfloor; |
1522 | archetype *at; |
1522 | archetype *at; |
1523 | |
1523 | |
1524 | for (nx=0; nx < settings.worldmaptilesizex; nx++) { |
1524 | for (nx = 0; nx < settings.worldmaptilesizex; nx++) { |
1525 | for (ny=0; ny < settings.worldmaptilesizey; ny++) { |
1525 | for (ny=0; ny < settings.worldmaptilesizey; ny++) { |
1526 | /* jitter factor */ |
1526 | /* jitter factor */ |
1527 | if (rndm(0, 2) > 0) { |
1527 | if (rndm(0, 2) > 0) { |
1528 | x=y=d=-1; |
1528 | x=y=d=-1; |
1529 | while (OUT_OF_REAL_MAP(m, x, y)) { |
1529 | while (OUT_OF_REAL_MAP(m, x, y)) { |
… | |
… | |
1727 | */ |
1727 | */ |
1728 | |
1728 | |
1729 | static void singing_in_the_rain(mapstruct *m, int wx, int wy) |
1729 | static void singing_in_the_rain(mapstruct *m, int wx, int wy) |
1730 | { |
1730 | { |
1731 | int x, y, i; |
1731 | int x, y, i; |
1732 | int nx, ny, d, j; |
1732 | uint32 nx, ny, d, j; |
1733 | int avoid, two, temp, sky, gotsnow, found, nodstk; |
1733 | int avoid, two, temp, sky, gotsnow, found, nodstk; |
1734 | object *ob, *tmp, *oldsnow, *topfloor; |
1734 | object *ob, *tmp, *oldsnow, *topfloor; |
1735 | const char *doublestack, *doublestack2; |
1735 | const char *doublestack, *doublestack2; |
1736 | archetype *at; |
1736 | archetype *at; |
1737 | |
1737 | |
1738 | for (nx=0; nx < settings.worldmaptilesizex; nx++) { |
1738 | for (nx = 0; nx < settings.worldmaptilesizex; nx++) { |
1739 | for (ny=0; ny < settings.worldmaptilesizey; ny++) { |
1739 | for (ny = 0; ny < settings.worldmaptilesizey; ny++) { |
1740 | /* jitter factor */ |
1740 | /* jitter factor */ |
1741 | if (rndm(0, 2) > 0) { |
1741 | if (rndm(0, 2) > 0) { |
1742 | x=y=d=-1; |
1742 | x=y=d=-1; |
1743 | while (OUT_OF_REAL_MAP(m, x, y)) { |
1743 | while (OUT_OF_REAL_MAP(m, x, y)) { |
1744 | d++; |
1744 | d++; |
… | |
… | |
1944 | * weather_effect() |
1944 | * weather_effect() |
1945 | */ |
1945 | */ |
1946 | |
1946 | |
1947 | static void plant_a_garden(mapstruct *m, int wx, int wy) |
1947 | static void plant_a_garden(mapstruct *m, int wx, int wy) |
1948 | { |
1948 | { |
1949 | int x, y, i; |
1949 | uint32 x, y, i; |
1950 | int avoid, two, temp, sky, gotsnow, found, days; |
1950 | int avoid, two, temp, sky, gotsnow, found, days; |
1951 | object *ob, *tmp; |
1951 | object *ob, *tmp; |
1952 | archetype *at; |
1952 | archetype *at; |
1953 | |
1953 | |
1954 | days = todtick / HOURS_PER_DAY; |
1954 | days = todtick / HOURS_PER_DAY; |
1955 | for (x=0; x < settings.worldmaptilesizex; x++) { |
1955 | for (x = 0; x < settings.worldmaptilesizex; x++) { |
1956 | for (y=0; y < settings.worldmaptilesizey; y++) { |
1956 | for (y=0; y < settings.worldmaptilesizey; y++) { |
1957 | (void)worldmap_to_weathermap(x, y, &wx, &wy, m); |
1957 | (void)worldmap_to_weathermap(x, y, &wx, &wy, m); |
1958 | ob = NULL; |
1958 | ob = NULL; |
1959 | at = NULL; |
1959 | at = NULL; |
1960 | avoid = 0; |
1960 | avoid = 0; |
… | |
… | |
2043 | */ |
2043 | */ |
2044 | |
2044 | |
2045 | static void change_the_world(mapstruct *m, int wx, int wy) |
2045 | static void change_the_world(mapstruct *m, int wx, int wy) |
2046 | { |
2046 | { |
2047 | int x, y, i; |
2047 | int x, y, i; |
2048 | int nx, ny, j, d; |
2048 | uint32 nx, ny, j, d; |
2049 | int avoid, two, temp, sky, gotsnow, found, days; |
2049 | int avoid, two, temp, sky, gotsnow, found, days; |
2050 | object *ob, *tmp, *doublestack; |
2050 | object *ob, *tmp, *doublestack; |
2051 | archetype *at, *dat; |
2051 | archetype *at, *dat; |
2052 | |
2052 | |
2053 | days = todtick / HOURS_PER_DAY; |
2053 | days = todtick / HOURS_PER_DAY; |
2054 | for (nx=0; nx < settings.worldmaptilesizex; nx++) { |
2054 | for (nx = 0; nx < settings.worldmaptilesizex; nx++) { |
2055 | for (ny=0; ny < settings.worldmaptilesizey; ny++) { |
2055 | for (ny = 0; ny < settings.worldmaptilesizey; ny++) { |
2056 | /* jitter factor */ |
2056 | /* jitter factor */ |
2057 | if (rndm(0, 2) > 0) { |
2057 | if (rndm(0, 2) > 0) { |
2058 | x=y=d=-1; |
2058 | x=y=d=-1; |
2059 | while (OUT_OF_REAL_MAP(m, x, y)) { |
2059 | while (OUT_OF_REAL_MAP(m, x, y)) { |
2060 | d++; |
2060 | d++; |
… | |
… | |
2173 | * Reduce the blockiness of the maps. m is the map we are currently processing. |
2173 | * Reduce the blockiness of the maps. m is the map we are currently processing. |
2174 | * wx and wy are |
2174 | * wx and wy are |
2175 | * the weathermap coordinates for the weathermap square we want to work on. |
2175 | * the weathermap coordinates for the weathermap square we want to work on. |
2176 | * This should be called from weather_effect() |
2176 | * This should be called from weather_effect() |
2177 | */ |
2177 | */ |
2178 | |
2178 | #if 0 |
2179 | static void feather_map(mapstruct *m, int wx, int wy) |
2179 | static void feather_map(mapstruct *m, int wx, int wy) |
2180 | { |
2180 | { |
2181 | int x, y, i, nx, ny, j; |
2181 | uint32 x, y, i, nx, ny, j; |
2182 | int avoid, two, gotsnow, nodstk; |
2182 | int avoid, two, gotsnow, nodstk; |
2183 | object *ob, *tmp, *oldsnow, *topfloor, *ntmp, *ntopfloor; |
2183 | object *ob, *tmp, *oldsnow, *topfloor, *ntmp, *ntopfloor; |
2184 | archetype *at; |
2184 | archetype *at; |
2185 | |
2185 | |
2186 | for (x=0; x < settings.worldmaptilesizex; x++) { |
2186 | for (x = 0; x < settings.worldmaptilesizex; x++) { |
2187 | for (y=0; y < settings.worldmaptilesizey; y++) { |
2187 | for (y = 0; y < settings.worldmaptilesizey; y++) { |
2188 | (void)worldmap_to_weathermap(x, y, &wx, &wy, m); |
2188 | (void)worldmap_to_weathermap(x, y, &wx, &wy, m); |
2189 | ob = NULL; |
2189 | ob = NULL; |
2190 | at = NULL; |
2190 | at = NULL; |
2191 | avoid = 0; |
2191 | avoid = 0; |
2192 | two = 0; |
2192 | two = 0; |
… | |
… | |
2196 | oldsnow = avoid_weather(&avoid, m, x, y, &gotsnow, 1); |
2196 | oldsnow = avoid_weather(&avoid, m, x, y, &gotsnow, 1); |
2197 | if (avoid) |
2197 | if (avoid) |
2198 | continue; |
2198 | continue; |
2199 | if (rndm(0, 20) == 0) |
2199 | if (rndm(0, 20) == 0) |
2200 | continue; |
2200 | continue; |
2201 | /* the bottom floor of scorn is not IS_FLOOR */ |
2201 | // the bottom floor of scorn is not IS_FLOOR |
2202 | topfloor=NULL; |
2202 | topfloor=NULL; |
2203 | for (tmp=GET_MAP_OB(m, x, y); tmp; |
2203 | for (tmp=GET_MAP_OB(m, x, y); tmp; |
2204 | topfloor = tmp,tmp = tmp->above) { |
2204 | topfloor = tmp,tmp = tmp->above) { |
2205 | if (strcmp(tmp->arch->name, "dungeon_magic") != 0) |
2205 | if (strcmp(tmp->arch->name, "dungeon_magic") != 0) |
2206 | if (!QUERY_FLAG(tmp, FLAG_IS_FLOOR) && |
2206 | if (!QUERY_FLAG(tmp, FLAG_IS_FLOOR) && |
2207 | !QUERY_FLAG(tmp, FLAG_OVERLAY_FLOOR)) |
2207 | !QUERY_FLAG(tmp, FLAG_OVERLAY_FLOOR)) |
2208 | break; |
2208 | break; |
2209 | } |
2209 | } |
2210 | /* topfloor should now be the topmost IS_FLOOR=1 */ |
2210 | // topfloor should now be the topmost IS_FLOOR=1 |
2211 | if (topfloor == NULL) |
2211 | if (topfloor == NULL) |
2212 | continue; |
2212 | continue; |
2213 | if (tmp != NULL) |
2213 | if (tmp != NULL) |
2214 | nodstk++; |
2214 | nodstk++; |
2215 | /* something is wrong with that sector. just skip it */ |
2215 | // something is wrong with that sector. just skip it |
2216 | |
2216 | |
2217 | j=rndm(1, 8); |
2217 | j=rndm(1, 8); |
2218 | nx = freearr_x[j]+x; |
2218 | nx = freearr_x[j]+x; |
2219 | ny = freearr_y[j]+y; |
2219 | ny = freearr_y[j]+y; |
2220 | if (OUT_OF_REAL_MAP(m, nx, ny)) |
2220 | if (OUT_OF_REAL_MAP(m, nx, ny)) |
… | |
… | |
2261 | } |
2261 | } |
2262 | } |
2262 | } |
2263 | } |
2263 | } |
2264 | } |
2264 | } |
2265 | } |
2265 | } |
2266 | |
2266 | #endif |
2267 | |
2267 | |
2268 | /* provide wx and wy. Will fill in with weathermap coordinates. Requires |
2268 | /* provide wx and wy. Will fill in with weathermap coordinates. Requires |
2269 | the current mapname (must be a worldmap), and your coordinates on the |
2269 | the current mapname (must be a worldmap), and your coordinates on the |
2270 | map. returns -1 if you give it something it can't figure out. 0 normally. |
2270 | map. returns -1 if you give it something it can't figure out. 0 normally. |
2271 | */ |
2271 | */ |
2272 | |
2272 | |
2273 | int worldmap_to_weathermap(int x, int y, int *wx, int *wy, mapstruct* m) |
2273 | int worldmap_to_weathermap(int x, int y, int *wx, int *wy, mapstruct* m) |
2274 | { |
2274 | { |
2275 | int spwtx, spwty; |
2275 | int spwtx, spwty; |
2276 | int fx, fy; |
2276 | uint32 fx, fy; |
2277 | int nx, ny; |
2277 | uint32 nx, ny; |
2278 | char* filename=m->path; |
2278 | char* filename=m->path; |
2279 | spwtx = (settings.worldmaptilesx * settings.worldmaptilesizex) / WEATHERMAPTILESX; |
2279 | spwtx = (settings.worldmaptilesx * settings.worldmaptilesizex) / WEATHERMAPTILESX; |
2280 | spwty = (settings.worldmaptilesy * settings.worldmaptilesizey) / WEATHERMAPTILESY; |
2280 | spwty = (settings.worldmaptilesy * settings.worldmaptilesizey) / WEATHERMAPTILESY; |
2281 | |
2281 | |
2282 | while (*filename == '/') |
2282 | while (*filename == '/') |
… | |
… | |
2922 | static void write_weather_images(void) |
2922 | static void write_weather_images(void) |
2923 | { |
2923 | { |
2924 | char filename[MAX_BUF]; |
2924 | char filename[MAX_BUF]; |
2925 | FILE *fp; |
2925 | FILE *fp; |
2926 | int x, y; |
2926 | int x, y; |
2927 | sint32 min[10], max[10], avgrain, avgwind, realmaxwind; |
2927 | sint32 min[10], max[10], realmaxwind; |
|
|
2928 | uint32 avgrain, avgwind; |
2928 | double scale[10], realscalewind; |
2929 | double scale[10], realscalewind; |
2929 | uint8 pixels[3 * 3 * WEATHERMAPTILESX]; |
2930 | uint8 pixels[3 * 3 * WEATHERMAPTILESX]; |
2930 | sint64 total_rainfall = 0; |
2931 | sint64 total_rainfall = 0; |
2931 | sint64 total_wind = 0; |
2932 | sint64 total_wind = 0; |
2932 | |
2933 | |
… | |
… | |
2942 | min[9] = 0; max[9] = 0; |
2943 | min[9] = 0; max[9] = 0; |
2943 | for (x=0; x < WEATHERMAPTILESX; x++) { |
2944 | for (x=0; x < WEATHERMAPTILESX; x++) { |
2944 | for (y=0; y < WEATHERMAPTILESY; y++) { |
2945 | for (y=0; y < WEATHERMAPTILESY; y++) { |
2945 | /* min[0] = MIN(min[0], weathermap[x][y].water); */ |
2946 | /* min[0] = MIN(min[0], weathermap[x][y].water); */ |
2946 | min[1] = MIN(min[1], weathermap[x][y].avgelev); |
2947 | min[1] = MIN(min[1], weathermap[x][y].avgelev); |
2947 | min[2] = MIN(min[2], weathermap[x][y].rainfall); |
2948 | min[2] = MIN((uint32) min[2], weathermap[x][y].rainfall); |
2948 | /* min[3] = MIN(min[3], weathermap[x][y].pressure); */ |
2949 | /* min[3] = MIN(min[3], weathermap[x][y].pressure); */ |
2949 | min[4] = MIN(min[4], weathermap[x][y].windspeed); |
2950 | min[4] = MIN(min[4], weathermap[x][y].windspeed); |
2950 | /* min[5] = MIN(min[5], weathermap[x][y].winddir); */ |
2951 | /* min[5] = MIN(min[5], weathermap[x][y].winddir); */ |
2951 | /* min[6] = MIN(min[6], weathermap[x][y].humid); */ |
2952 | /* min[6] = MIN(min[6], weathermap[x][y].humid); */ |
2952 | /* min[7] = MIN(min[7], real_temp[x][y]); */ |
2953 | /* min[7] = MIN(min[7], real_temp[x][y]); */ |
2953 | /* min[8] = MIN(min[8], weathermap[x][y].sky); */ |
2954 | /* min[8] = MIN(min[8], weathermap[x][y].sky); */ |
2954 | /* min[9] = MIN(min[9], weathermap[x][y].darkness); */ |
2955 | /* min[9] = MIN(min[9], weathermap[x][y].darkness); */ |
2955 | |
2956 | |
2956 | /* max[0] = MAX(max[0], weathermap[x][y].water); */ |
2957 | /* max[0] = MAX(max[0], weathermap[x][y].water); */ |
2957 | max[1] = MAX(max[1], weathermap[x][y].avgelev); |
2958 | max[1] = MAX(max[1], weathermap[x][y].avgelev); |
2958 | max[2] = MAX(max[2], weathermap[x][y].rainfall); |
2959 | max[2] = MAX((uint32) max[2], weathermap[x][y].rainfall); |
2959 | /* max[3] = MAX(max[3], weathermap[x][y].pressure); */ |
2960 | /* max[3] = MAX(max[3], weathermap[x][y].pressure); */ |
2960 | max[4] = MAX(max[4], weathermap[x][y].windspeed); |
2961 | max[4] = MAX(max[4], weathermap[x][y].windspeed); |
2961 | /* max[5] = MAX(max[5], weathermap[x][y].winddir); */ |
2962 | /* max[5] = MAX(max[5], weathermap[x][y].winddir); */ |
2962 | /* max[6] = MAX(max[6], weathermap[x][y].humid); */ |
2963 | /* max[6] = MAX(max[6], weathermap[x][y].humid); */ |
2963 | /* max[7] = MAX(max[7], real_temp[x][y]); */ |
2964 | /* max[7] = MAX(max[7], real_temp[x][y]); */ |