Sorry for not replying earlier since the DM in life of reality decided to be his guest for 110 days in a small room with toilet and telly .
Here is the rough code diff of 290lines with lot of blankspace for weather.c for server-1.11 :
Code: Select all
--- /root/COMPILE/crossfire-1.11.0-orig/server/weather.c 2008-02-01 04:56:00.000000000 -0100
+++ /root/COMPILE/crossfire-1.11.0/server/weather.c 2012-11-08 00:12:28.329422270 -0100
@@ -72,12 +72,14 @@ static void let_it_snow(mapstruct *m, in
static void singing_in_the_rain(mapstruct *m, int wx, int wy);
static void plant_a_garden(mapstruct *m, int wx, int wy);
static void change_the_world(mapstruct *m, int wx, int wy);
+static void feather_map(mapstruct *m, int wx, int wy);
static const char *weathermap_to_worldmap_corner(int wx, int wy, int *x, int *y, int dir);
static int polar_distance(int x, int y, int equator);
static void update_humid(void);
static int humid_tile(int x, int y);
static void temperature_calc(int x, int y, const timeofday_t *tod);
static int real_temperature(int x, int y);
+static int real_temp(int x, int y);
static void smooth_pressure(void);
static void perform_pressure(void);
static void smooth_wind(void);
@@ -96,7 +98,7 @@ static const int season_timechange[5][HO
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 2 3 4 5 6 7
8 9 10 11 12 13 */
{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},
{0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 1, 1,
1, 1, 1, 1, 1, 0},
{0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
@@ -144,7 +146,7 @@ static weather_avoids_t weather_avoids[]
{"lava", 0, NULL},
{"permanent_lava", 0, NULL},
{NULL, 0, NULL}
-};
+};
/*
* this table is identical to the one above, except these are tiles to avoid
@@ -257,14 +259,14 @@ static const weather_grow_t weather_tile
{"woods5", "brush", 1, 0.6, 1.5, 20, 70, -15, 20, 2000, 5500, 0},
{"forestsparse", "brush", 1, 0.3, 1.5, 15, 60, -20, 25, 0, 4500, 0},
/* big */
- /*
+ /* DISABELED */
{"ytree_2", "brush", 2, 0.1, 0.6, 30, 60, 10, 25, 1000, 3500, 0},
{"tree3", "grass", 2, 0.9, 2.5, 50, 100, 10, 35, 1000, 4000, 0},
{"tree5", "grass", 2, 0.5, 1.5, 40, 90, -10, 24, 3000, 8000, 0},
{"tree3", "grassmeduim", 2, 0.9, 2.5, 50, 100, 10, 35, 1000, 4000, 0},
{"tree5", "grassmedium", 2, 0.5, 1.5, 40, 90, -10, 24, 3000, 8000, 0},
{"tree3", "grassdark", 2, 0.9, 2.5, 50, 100, 10, 35, 1000, 4000, 0},
- {"tree5", "grassdark", 2, 0.5, 1.5, 40, 90, -10, 24, 3000, 8000, 0},*/
+ {"tree5", "grassdark", 2, 0.5, 1.5, 40, 90, -10, 24, 3000, 8000, 0}, /* DISABLED */
/* mountians */
{"steppe", NULL, 1, 0.5, 1.3, 0, 30, -20, 35, 1000, 6000, 0},
{"steppelight", NULL, 1, 0.0, 0.6, 0, 20, -50, 35, 0, 5000, 0},
@@ -281,7 +283,7 @@ static const weather_grow_t weather_tile
{"palms", "pstone_1", 1, 0.01, 0.1, 0, 30, 5, 99, 0, 4000, 0},
{"large_stones", NULL, 1, 0.0, 9.9, 0, 100, -50, 50, 6000, 8000, 0},
{"earth", NULL, 1, 0.0, 1.0, 0, 70, -30, 15, 0, 6000, 0},
- {"medium_stones", NULL, 1, 1.0, 3.0, 70, 100, -30, 10, 0, 4000, 0}, /*unsure*/
+ {"medium_stones", NULL, 1, 1.0, 3.0, 70, 100, -30, 10, 0, 4000, 0}, /*unsure*/
{"earth", NULL, 1, 0.1, 0.9, 20, 80, -30, 30, 0, 4999, 0}, /* tundra */
{"swamp", NULL, 1, 1.0, 9.9, 50, 100, -30, 10, 0, 4000, 0},/* cold marsh */
{"earth", NULL, 1, 0.0, 99.9, 0, 100, -99, 99, 0, 99999, 0}, /* debug */
@@ -401,8 +403,8 @@ void tick_the_clock(void)
write_windspeedmap();
if (todtick%24 == 0)
write_humidmap();
-/* if (todtick%25 == 0)
- write_elevmap(); */
+/* DISABLED */ if (todtick%25 == 0)
+ write_elevmap(); /* DISABLED */
if (todtick%26 == 0)
write_temperaturemap();
if (todtick%27 == 0)
@@ -768,7 +770,7 @@ static void init_gulfstreammap(void)
break;
case 4:
case 5:
- case 6:
+ case 6:
for (tx=0; tx < GULF_STREAM_WIDTH; tx++) {
gulf_stream_speed[tx][y] = rndm(GULF_STREAM_BASE_SPEED,
GULF_STREAM_BASE_SPEED+10);
@@ -810,7 +812,7 @@ static void init_gulfstreammap(void)
break;
case 4:
case 5:
- case 6:
+ case 6:
for (tx=0; tx < GULF_STREAM_WIDTH; tx++) {
gulf_stream_speed[tx][y] = rndm(GULF_STREAM_BASE_SPEED,
GULF_STREAM_BASE_SPEED+10);
@@ -1348,7 +1350,7 @@ static void perform_weather(void)
if (!settings.dynamiclevel)
return;
-
+
/* move right to left, top to bottom */
if (wmperformstartx+1 == settings.worldmaptilesx) {
wmperformstartx = 0;
@@ -1357,7 +1359,7 @@ static void perform_weather(void)
wmperformstartx++;
if (wmperformstarty == settings.worldmaptilesy)
wmperformstartx = wmperformstarty = 0;
-
+
sprintf(filename, "world/world_%d_%d",
wmperformstartx+settings.worldmapstartx,
wmperformstarty+settings.worldmapstarty);
@@ -1365,7 +1367,7 @@ static void perform_weather(void)
m = ready_map_name(filename, 0);
if (m == NULL)
return; /* hrmm */
-
+
/* for now, all we do is decay stuff. more to come */
decay_objects(m);
weather_effect(filename);
@@ -1423,9 +1425,9 @@ void weather_effect(const char *filename
let_it_snow(m, wx, wy);
singing_in_the_rain(m, wx, wy);
}
- /* if (settings.dynamiclevel >= 4) {
- feather_map(m, wx, wy, filename);
- }*/
+ /* DISABLED */ if (settings.dynamiclevel >= 4) {
+ feather_map(m, wx, wy );
+ } /* DISABLED */
if (settings.dynamiclevel >= 3) {
plant_a_garden(m, wx, wy);
}
@@ -1439,14 +1441,14 @@ void weather_effect(const char *filename
* x and y are the coordinates inside the current map m. If grow is
* 1, we use the growth table, rather than the avoidance table.
*
- * Returns the object pointer for any snow item it found, so you can
+ * Returns the object pointer for any snow item it found, so you can
* destroy/melt it.
*/
static object *avoid_weather(int *av, mapstruct *m, int x, int y, int *gs, int grow)
{
int avoid, gotsnow, i;
-
+
object *tmp, *snow;
avoid = 0;
gotsnow = 0;
@@ -1491,7 +1493,7 @@ static object *avoid_weather(int *av, ma
}
*gs = gotsnow;
*av = avoid;
-
+
return snow;
}
@@ -1784,7 +1786,7 @@ static void singing_in_the_rain(mapstruc
at = find_archetype("mountain2_rivlets"); break;}
else if (tmp && (!strcmp(tmp->arch->name, "mountain4"))){
at = find_archetype("mountain2_rivlets"); break;}
- if (sky == SKY_LIGHT_RAIN || sky == SKY_RAIN) {
+ if (sky == SKY_LIGHT_RAIN || sky == SKY_RAIN) {
switch (rndm(0, SKY_HAIL-sky)) {
case 0: at = find_archetype("rain1"); break;
case 1: at = find_archetype("rain2"); break;
@@ -1969,7 +1971,7 @@ static void plant_a_garden(mapstruct *m,
avoid = 0;
two = 0;
gotsnow = 0;
- /*temp = real_world_temperature(x, y, m);*/
+ /* temp = real_world_temperature(x, y, m); */
temp = weathermap[wx][wy].realtemp;
sky = weathermap[wx][wy].sky;
(void)avoid_weather(&avoid, m, x, y, &gotsnow, 1);
@@ -2181,7 +2183,7 @@ static void change_the_world(mapstruct *
}
-#if 0
+/* DISABLED #if 0 */
/* feather_map is no longer used - should perhaps be removed.
* MSW 2006-06-02
*/
@@ -2282,7 +2284,7 @@ static void feather_map(mapstruct *m, in
}
}
}
-#endif
+/* DISABLED #endif */
/* provide wx and wy. Will fill in with weathermap coordinates. Requires
@@ -2342,7 +2344,7 @@ static const char *weathermap_to_worldma
int spwtx, spwty;
int tx, ty, nx, ny;
static char mapname[ MAX_BUF ];
-
+
spwtx = (settings.worldmaptilesx * settings.worldmaptilesizex) / WEATHERMAPTILESX;
spwty = (settings.worldmaptilesy * settings.worldmaptilesizey) / WEATHERMAPTILESY;
switch (dir) {
@@ -2359,7 +2361,7 @@ static const char *weathermap_to_worldma
ty = (wy*spwty)-1;
else
ty = wy;
-
+
nx = (tx / settings.worldmaptilesizex) + settings.worldmapstartx;
ny = (ty / settings.worldmaptilesizey) + settings.worldmapstarty;
snprintf(mapname, MAX_BUF, "world/world_%d_%d", nx, ny);
@@ -2435,7 +2437,7 @@ static int humid_tile(int x, int y)
}
humid = (weathermap[x][y].humid * 2 +
weathermap[ox][oy].humid * weathermap[ox][oy].windspeed +
- weathermap[x][y].water + rndm(0, 10)) /
+ weathermap[x][y].water + rndm(0, 10)) /
(weathermap[ox][oy].windspeed+3) + rndm(0, 5);
if (humid < 0)
humid = 1;
@@ -2520,7 +2522,7 @@ int real_world_temperature(int x, int y,
{
int wx, wy, temp, eleva, elevb;
object *op;
- /*LOG(llevDebug, "real_world_temperature: worldmaptoweathermap : %s\n",m->path);*/
+ /* DISABLED */ LOG(llevDebug, "real_world_temperature: worldmaptoweathermap : %s\n",m->path); /* DISABLED */
worldmap_to_weathermap(x, y, &wx, &wy, /*m->path*/m);
temp = real_temperature(wx, wy);
if (weathermap[wx][wy].avgelev < 0)
@@ -2962,27 +2964,27 @@ static void write_weather_images(void)
min[9] = 0; max[9] = 0;
for (x=0; x < WEATHERMAPTILESX; x++) {
for (y=0; y < WEATHERMAPTILESY; y++) {
-/* min[0] = MIN(min[0], weathermap[x][y].water); */
+/* DISABLED */ min[0] = MIN(min[0], weathermap[x][y].water); /* DISABLED */
min[1] = MIN(min[1], weathermap[x][y].avgelev);
min[2] = MIN(min[2], weathermap[x][y].rainfall);
-/* min[3] = MIN(min[3], weathermap[x][y].pressure); */
+/* DISABLED */ min[3] = MIN(min[3], weathermap[x][y].pressure); /* DISABLED */
min[4] = MIN(min[4], weathermap[x][y].windspeed);
-/* min[5] = MIN(min[5], weathermap[x][y].winddir); */
-/* min[6] = MIN(min[6], weathermap[x][y].humid); */
-/* min[7] = MIN(min[7], real_temp[x][y]); */
-/* min[8] = MIN(min[8], weathermap[x][y].sky); */
-/* min[9] = MIN(min[9], weathermap[x][y].darkness); */
+/* DISABLED */ min[5] = MIN(min[5], weathermap[x][y].winddir); /* DISABLED */
+/* DISABLED */ min[6] = MIN(min[6], weathermap[x][y].humid); /* DISABLED */
+/* DISABLED */ min[7] = MIN(min[7], weathermap[x][y].realtemp); /* DISABLED */
+/* DISABLED */ min[8] = MIN(min[8], weathermap[x][y].sky); /* DISABLED */
+/* DISABLED */ min[9] = MIN(min[9], weathermap[x][y].darkness); /* DISABLED */
-/* max[0] = MAX(max[0], weathermap[x][y].water); */
+/* DISABLED */ max[0] = MAX(max[0], weathermap[x][y].water); /* DISABLED */
max[1] = MAX(max[1], weathermap[x][y].avgelev);
max[2] = MAX(max[2], weathermap[x][y].rainfall);
-/* max[3] = MAX(max[3], weathermap[x][y].pressure); */
+/* DISABLED */ max[3] = MAX(max[3], weathermap[x][y].pressure); /* DISABLED */
max[4] = MAX(max[4], weathermap[x][y].windspeed);
-/* max[5] = MAX(max[5], weathermap[x][y].winddir); */
-/* max[6] = MAX(max[6], weathermap[x][y].humid); */
-/* max[7] = MAX(max[7], real_temp[x][y]); */
-/* max[8] = MAX(max[8], weathermap[x][y].sky); */
-/* max[9] = MAX(max[9], weathermap[x][y].darkness); */
+/* DISABLED */ max[5] = MAX(max[5], weathermap[x][y].winddir); /* DISABLED */
+/* DISABLED */ max[6] = MAX(max[6], weathermap[x][y].humid); /* DISABLED */
+/* DISABLED */ max[7] = MAX(max[7], weathermap[x][y].realtemp); /* DISABLED */
+/* DISABLED */ max[8] = MAX(max[8], weathermap[x][y].sky); /* DISABLED */
+/* DISABLED */ max[9] = MAX(max[9], weathermap[x][y].darkness); /* DISABLED */
total_rainfall += weathermap[x][y].rainfall;
total_wind += weathermap[x][y].windspeed;
}
@@ -3034,8 +3036,8 @@ static void write_weather_images(void)
pixels[3 * x + (1 * WEATHERMAPTILESX * 3 + BLUE)] = speed;
} else {
speed = (speed - realmaxwind) * realscalewind;
-/* if (speed < 100)*/
-/* speed = 100;*/
+/* DISABLED */ if (speed < 100) /* DISABLED */
+/* DISABLED */ speed = 100; /* DISABLED */
pixels[3 * x + (1 * WEATHERMAPTILESX * 3 + RED)] = speed;
pixels[3 * x + (1 * WEATHERMAPTILESX * 3 + GREEN)] = 0;
pixels[3 * x + (1 * WEATHERMAPTILESX * 3 + BLUE)] = 0;
@@ -3052,7 +3054,7 @@ static void write_weather_images(void)
for (x=0; x < WEATHERMAPTILESX; x++) {
uint32 dir = skies[weathermap[x][y].sky];
pixels[3 * x + (0 * WEATHERMAPTILESX * 3 + BLUE)] = (uint8) ((weathermap[x][y].humid - min[6]) * scale[6]);
- /*pixels[3 * x + (1 * WEATHERMAPTILESX * 3 + RED)] = (uint8) ((real_temp[x][y] - min[7]) * scale[7]);*/
+ /* DISABLED */ pixels[3 * x + (1 * WEATHERMAPTILESX * 3 + RED)] = (uint8) ((weathermap[x][y].realtemp - min[7]) * scale[7]); /* DISABLED */
pixels[3 * x + (1 * WEATHERMAPTILESX * 3 + RED)] = 1;
pixels[3 * x + (2 * WEATHERMAPTILESX * 3 + RED)] = (uint8) ((dir & 0x00FF0000) >> 16);
pixels[3 * x + (2 * WEATHERMAPTILESX * 3 + GREEN)] = (uint8) ((dir & 0x0000FF00) >> 8);
Hope that hack does not harm anyone -- seems to work for me .