33 #define POLAR_BASE_TEMP 0
34 #define EQUATOR_BASE_TEMP 30
35 #define SEASONAL_ADJUST 10
36 #define GULF_STREAM_WIDTH 3
37 #define GULF_STREAM_BASE_SPEED 40
40 #define PRESSURE_ITERATIONS 30
41 #define PRESSURE_AREA 180
42 #define PRESSURE_ROUNDING_FACTOR 2
43 #define PRESSURE_ROUNDING_ITER 1
44 #define PRESSURE_SPIKES 3
45 #define PRESSURE_MAX 1040
46 #define PRESSURE_MIN 960
50 #define SKY_LIGHTCLOUD 1
51 #define SKY_OVERCAST 2
52 #define SKY_LIGHT_RAIN 3
54 #define SKY_HEAVY_RAIN 5
55 #define SKY_HURRICANE 6
60 #define SKY_LIGHT_SNOW 13
62 #define SKY_HEAVY_SNOW 15
63 #define SKY_BLIZZARD 16
72 #define WIND_FACTOR 4.0
75 #define WEATHERMAPTILESX 100
76 #define WEATHERMAPTILESY 100
213 .worldmaptilesizey = 50,
227 {
"mint",
"grass", 10, 1.0, 2.0, 30, 100, 10, 25, -100, 9999, 2},
228 {
"rose_red",
"grass", 15, 1.0, 2.0, 30, 100, 10, 25, -100, 9999, 2},
229 {
"rose_red",
"hills", 15, 1.0, 2.0, 30, 100, 10, 25, -100, 9999, 2},
234 {
"mint",
"brush", 8, 1.0, 2.0, 30, 100, 10, 25, -100, 9999, 2},
235 {
"blackroot",
"swamp", 15, 1.6, 2.0, 60, 100, 20, 30, -100, 1500, 0},
236 {
"mushroom_1",
"grass", 15, 1.6, 2.0, 60, 100, 3, 30, -100, 1500, 0},
237 {
"mushroom_2",
"grass", 15, 1.6, 2.0, 60, 100, 3, 30, -100, 1500, 0},
238 {
"mushroom_1",
"swamp", 15, 1.6, 2.0, 60, 100, 3, 30, -100, 1500, 0},
239 {
"mushroom_2",
"swamp", 15, 1.6, 2.0, 60, 100, 3, 30, -100, 1500, 0},
240 {
"mushroom_1",
"hills", 15, 1.6, 2.0, 60, 100, 3, 30, -100, 1500, 0},
241 {
"mushroom_2",
"hills", 15, 1.6, 2.0, 60, 100, 3, 30, -100, 1500, 0},
242 {
"pipeweed",
"farmland", 20, 1.0, 2.0, 30, 100, 10, 25, 100, 5000, 0},
243 {
"cabbage",
"farmland", 10, 1.0, 2.0, 30, 100, 10, 25, -100, 9999, 0},
244 {
"onion",
"farmland", 10, 1.0, 2.0, 30, 100, 10, 25, 100, 9999, 0},
245 {
"carrot",
"farmland", 10, 1.0, 2.0, 30, 100, 10, 25, 100, 9999, 0},
246 {
"thorns",
"brush", 15, 0.5, 1.3, 30, 100, 10, 25, -100, 9999, 0},
247 {
"mountain_foilage",
"mountain", 6, 1.0, 2.0, 25, 100, 5, 30, 0, 15999, 2},
248 {NULL, NULL, 1, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0}
258 {
"dunes", NULL, 2, 0.0, 0.03, 0, 20, 10, 99, 0, 4000, 0},
259 {
"desert", NULL, 1, 0.0, 0.05, 0, 20, 10, 99, 0, 4000, 0},
260 {
"pstone_2", NULL, 1, 0.0, 0.05, 0, 20, -30, 10, 0, 4000, 0},
261 {
"pstone_3", NULL, 1, 0.0, 0.05, 0, 20, -30, 10, 0, 4000, 0},
262 {
"grassbrown", NULL, 1, 0.05, 1.0, 20, 80, -20, -3, 0, 5000, 0},
263 {
"grass_br_gr", NULL, 1, 0.05, 1.0, 20, 80, -3, 5, 0, 5000, 0},
264 {
"grass", NULL, 1, 0.05, 1.0, 20, 80, 5, 15, 0, 5000, 0},
265 {
"grassmedium", NULL, 1, 0.05, 1.0, 20, 80, 15, 25, 0, 5000, 0},
266 {
"grassdark", NULL, 1, 0.05, 1.0, 20, 80, 25, 35, 0, 5000, 0},
267 {
"brush", NULL, 1, 0.2, 1.0, 25, 70, 0, 30, 500, 6000, 0},
269 {
"evergreens2",
"brush", 1, 0.5, 1.8, 30, 90, -30, 24, 3000, 8000, 0},
270 {
"fernsdense",
"brush", 1, 0.9, 2.5, 50, 100, 10, 35, 1000, 6000, 0},
271 {
"fernssparse",
"brush", 1, 0.7, 2.0, 30, 90, -15, 35, 0, 4000, 0},
272 {
"woods4",
"brush", 1, 0.1, 0.8, 30, 60, -5, 25, 1000, 4500, 0},
273 {
"woods5",
"brush", 1, 0.6, 1.5, 20, 70, -15, 20, 2000, 5500, 0},
274 {
"forestsparse",
"brush", 1, 0.3, 1.5, 15, 60, -20, 25, 0, 4500, 0},
285 {
"steppe", NULL, 1, 0.5, 1.3, 0, 30, -20, 35, 1000, 6000, 0},
286 {
"steppelight", NULL, 1, 0.0, 0.6, 0, 20, -50, 35, 0, 5000, 0},
287 {
"hills", NULL, 1, 0.1, 0.9, 20, 80, -10, 30, 5000, 8500, 0},
288 {
"hills_rocky", NULL, 1, 0.0, 0.9, 0, 100, -50, 50, 5000, 8500, 0},
289 {
"swamp", NULL, 1, 1.0, 9.9, 55, 80, 10, 50, 0, 1000, 0},
290 {
"deep_swamp", NULL, 1, 1.0, 9.9, 80, 100, 10, 50, 0, 1000, 0},
291 {
"mountain", NULL, 1, 0.0, 9.9, 0, 100, -50, 50, 8000, 10000, 0},
292 {
"mountain2", NULL, 1, 0.0, 9.9, 0, 100, -50, 50, 9500, 11000, 0},
293 {
"mountain4", NULL, 1, 0.0, 9.9, 0, 100, -50, 50, 10500, 12000, 0},
294 {
"mountain5", NULL, 1, 0.0, 9.9, 0, 100, -50, 50, 11500, 13500, 0},
295 {
"wasteland", NULL, 1, 0.0, 9.9, 0, 100, -50, 50, 13000, 99999, 0},
297 {
"palms",
"pstone_1", 1, 0.01, 0.1, 0, 30, 5, 99, 0, 4000, 0},
298 {
"large_stones", NULL, 1, 0.0, 9.9, 0, 100, -50, 50, 6000, 8000, 0},
299 {
"earth", NULL, 1, 0.0, 1.0, 0, 70, -30, 15, 0, 6000, 0},
300 {
"medium_stones", NULL, 1, 1.0, 3.0, 70, 100, -30, 10, 0, 4000, 0},
301 {
"earth", NULL, 1, 0.1, 0.9, 20, 80, -30, 30, 0, 4999, 0},
302 {
"swamp", NULL, 1, 1.0, 9.9, 50, 100, -30, 10, 0, 4000, 0},
303 {
"earth", NULL, 1, 0.0, 99.9, 0, 100, -99, 99, 0, 99999, 0},
304 {NULL, NULL, 1, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0}
360 LOG(
llevError,
"weathermap_to_worldmap_corner: Invalid direction %d given, should be in set {2,4,6,8}.\n", dir);
366 snprintf(
buffer, bufsize,
"world/world_%d_%d", nx, ny);
385 if ((x+y) > equator) {
389 }
else if ((x+y) < equator) {
463 const char *filename =
m->path;
465 while (*filename ==
'/') {
474 if (fx == -2 || fy == -2) {
481 LOG(
llevDebug,
"worldmap_to_weathermap(%s)\n", filename);
484 int amt = sscanf(filename,
"world/world_%d_%d", &fx, &fy);
535 int avoid, gotsnow, i;
536 object *tmp, *snow = NULL;
555 if (avoid && gotsnow) {
574 if (avoid && gotsnow) {
618 #define WEATHER_OVERLAY 1
619 #define WEATHER_NO_FLOOR 2
620 #define WEATHER_NO_SAVE 4
689 while (*
line ==
' ' || *
line ==
',')
724 for (tx = -1; tx < 2; tx++) {
725 for (ty = -1; ty < 2; ty++) {
726 if (!(tx == 0 && ty == 0)) {
759 for (tx = -1; tx < 2; tx++) {
760 for (ty = -1; ty < 2; ty++) {
761 if (tx != 0 && ty != 0) {
829 int x, y, l, n, j, k, is_storm;
847 is_storm = (n < 1013 &&
rndm(1, 10) == 1);
848 for (j = x-2; j < x+2; j++) {
849 for (k = y-2; k < y+2; k++) {
877 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};
934 for (i = 0; i <= tod->
hour; i++) {
970 int wx, wy, temp, eleva, elevb, trees;
1001 elevb = eleva - elevb;
1030 int dist, equator, elev, n, trees;
1044 n -= (tod->
month*tdiff);
1075 else if (trees >= 30){
1105 int calc, inv_pressure;
1119 press_root = sqrt(inv_pressure);
1120 calc =
MAX(0,
MIN((
int)(max_root*100), (
int)(press_root *
weathermap[x][y].humid)));
1125 calc /= (int)(max_root*100 / 7) + 1;
1136 if (temp > 0 && temp < 5 &&
weathermap[x][y].humid > 95 &&
1140 if (temp > 0 && temp < 5 &&
weathermap[x][y].humid > 70 &&
1163 int buffer_pressure;
1174 for (x = xy-xy_eff; x < xy_eff; ++x) {
1203 static int humid_tile(
const int x,
const int y,
const int dark) {
1205 int ox = x, oy = y, humid, evap, tempeffect, lightness;
1234 tempeffect = light*light/4;
1237 tempeffect = light*light/5;
1244 tempeffect = light*4/5;
1248 tempeffect = light/2;
1252 tempeffect = light/3;
1257 tempeffect = light/5;
1268 evap =
MAX(0, evap);
1306 int x, y, tx, diroffset,
dirdiff, ystart, ydiff, ylimup, ylimlow;
1330 for (y = ystart; y > ylimlow && y < ylimup; y += ydiff) {
1362 if (
rndm(1, 1000) == 1) {
1382 if (
rndm(1, 75) <= 2) {
1509 if (
rndm(0, 99) + pct_precip >= 100) {
1514 if (temp < -2 || (temp <= 2 &&
rndm(0, 2+temp) - 2 <= 0)) {
1525 if (tmp->
arch == at) {
1529 else if ((tmp->
arch->
name == snowc && at->
name == rain) ||
1564 int x, y, temp, sky, wx, wy;
1568 for (x = 0; x <
m->width; ++x)
1569 for (y = 0; y <
m->height; ++y) {
1584 int x, y, i, wx, wy;
1586 int avoid, temp, sky, gotsnow,
found, nodstk;
1587 object *ob, *tmp, *oldsnow, *topfloor;
1588 archetype *at, *doublestack, *doublestack2;
1595 if (
rndm(0, 2) > 0) {
1638 if (tmp->arch->name != dungmag) {
1645 if (topfloor == NULL) {
1654 if (repl->special_snow != NULL) {
1655 at = repl->special_snow;
1657 if (repl->doublestack_arch != NULL && !nodstk) {
1658 doublestack = repl->doublestack_arch;
1664 if (gotsnow && at) {
1665 if (oldsnow->
arch == at) {
1672 doublestack2 = NULL;
1675 if (repl->doublestack_arch == NULL) {
1680 doublestack2 = repl->doublestack_arch;
1685 if (tmp != NULL && doublestack2 != NULL) {
1686 if (tmp->
arch == doublestack2) {
1695 if (doublestack != NULL) {
1705 if (repl->special_snow == NULL) {
1709 if (tmp->
arch == repl->special_snow) {
1733 if (tmp->
arch->
name == melt->tile) {
1734 at = melt->special_snow;
1782 int x, y, i, wx, wy;
1784 int avoid, temp, sky, gotsnow, nodstk;
1785 object *ob, *tmp, *oldsnow, *topfloor;
1786 archetype *at, *doublestack, *doublestack2;
1793 if (
rndm(0, 2) > 0) {
1836 if (tmp->
arch->
name == melt->tile) {
1837 at = melt->special_snow;
1847 default: at = NULL;
break;
1855 default: at = NULL;
break;
1861 if (tmp->arch->name != dungmag) {
1868 if (topfloor == NULL) {
1877 if (repl->doublestack_arch != NULL && !nodstk) {
1878 doublestack = repl->doublestack_arch;
1883 if (gotsnow && at) {
1884 if (oldsnow->
arch == at) {
1890 doublestack2 = NULL;
1892 if (repl->doublestack_arch == NULL) {
1897 doublestack2 = repl->doublestack_arch;
1902 if (tmp != NULL && doublestack2 != NULL) {
1903 if (tmp->arch == doublestack2) {
1912 if (doublestack != NULL) {
1938 doublestack2 = NULL;
1940 if (repl->doublestack_arch == NULL) {
1945 doublestack2 = repl->doublestack_arch;
1949 if (tmp != NULL && doublestack2 != NULL) {
1950 if (tmp->
arch == doublestack2) {
1975 int x, y, i, wx, wy;
1976 int avoid, two, temp, sky, gotsnow,
found,
days;
2074 int x, y, i, wx, wy;
2076 int avoid, two, temp, sky, gotsnow,
found,
days;
2077 object *ob, *tmp, *doublestack;
2084 if (
rndm(0, 2) > 0) {
2285 if ((fp = fopen(filename,
"w")) == NULL) {
2286 LOG(
llevError,
"Cannot open %s for writing\n", filename);
2321 if (!
m || !
m->outdoor)
2344 if (windspeed*2 < wt)
2349 if (
rndm(0, windspeed)+
rndm(0, windspeed) < wt)
2390 int found, is_obj_name, tree_count;
2392 snprintf(filename,
sizeof(filename),
"%s/%s",
settings->
confdir, conf_filename);
2395 "init_config_vals: Could not open file %s. No forestry data is defined. %s\n",
2424 LOG(
llevError,
"init_config_vals: Malformed name entry in %s, line %ld.\n",
2430 found = sscanf(
line,
"%d, %d\n", &is_obj_name, &tree_count);
2433 LOG(
llevError,
"init_config_vals: Malformed forestry entry in %s, line %ld.\n",
2444 frst->
is_obj = is_obj_name;
2475 int found, is_effect;
2477 snprintf(filename,
sizeof(filename),
"%s/%s",
settings->
confdir, conf_filename);
2480 "init_weatheravoid: Could not open file %s. No weatheravoid data is defined. %s\n",
llevError);
2507 LOG(
llevError,
"init_weatheravoid: Malformed name entry in %s, line %ld.\n",
2513 found = sscanf(
line,
"%d\n", &is_effect);
2516 LOG(
llevError,
"init_weatheravoid: Malformed effect flag entry in %s, line %ld.\n",
2527 frst->
snow = is_effect;
2559 snprintf(filename,
sizeof(filename),
"%s/%s",
settings->
confdir, conf_filename);
2589 LOG(
llevError,
"init_weather_replace: Malformed name entry in %s, line %ld.\n",
2599 LOG(
llevError,
"init_weather_replace: Malformed replacement entry in %s, line %ld.\n",
2609 LOG(
llevError,
"init_weather_replace: Malformed doublestack entry in %s, line %ld.\n",
2618 LOG(
llevError,
"init_weatheravoid: Malformed archetype/object flag entry in %s, line %ld.\n",
2630 if (strcmp(repl,
"NONE") == 0)
2635 if (strcmp(doublestack,
"NONE") == 0)
2671 if (!
m || !tx || !ty)
2713 if (!
m || !water || !elev || !trees)
2750 int x, y, tx, ty, nx, ny, ax, ay, j;
2755 int water, space, trees;
2766 water = space = trees = 0;
2774 for (nx = 0, ax = tx; nx < spwtx && ax <
wset.
worldmaptilesizex && space < spwtx*spwty; ax++, nx++) {
2775 for (ny = 0, ay = ty; ny < spwty && ay <
wset.
worldmaptilesizey && space < spwtx*spwty; ay++, ny++, space++) {
2788 if (space < spwtx*spwty) {
2799 for (nx = 0, ax = tx; nx < spwtx && ax <
wset.
worldmaptilesizex && space < spwtx*spwty; ax++, nx++) {
2800 for (ny = j, ay =
MAX(0, ty-(spwty-1)); ny < spwty && ay <= ty && space < spwtx*spwty; space++, ay++, ny++) {
2814 for (ax =
MAX(0, tx-(spwtx-1)); nx < spwtx && ax <= tx && space < spwtx*spwty; ax++, nx++) {
2815 for (ny = 0, ay = ty; ny < spwty && ay <
wset.
worldmaptilesizey && space < spwtx*spwty; ay++, ny++, space++) {
2830 for (nx = 0, ax =
MAX(0, tx - (spwtx-1)); nx < spwtx && ax <= tx && space < spwtx*spwty; ax++, nx++) {
2831 for (ny = j, ay =
MAX(0, ty-(spwty-1)); ny < spwty && ay <= ty && space < spwtx*spwty; space++, ay++, ny++) {
2911 int x, y, tx, starty, ymul, diroffset,
dirdiff;
2943 switch (
rndm(0, 6)) {
3024 switch (
rndm(0, 3)) {
3027 case 2:
if (x) x--;
break;
3028 case 3:
if (y) y--;
break;
3040 n =
rndm(500, 2000);
3052 if ((fp = fopen(
buf,
"r")) == NULL) {
3060 if ((cp = strrchr(
buf,
'\n')) != NULL)
3070 if ((cp = strchr(
buf,
' ')) != NULL) {
3078 int size = atoi(cp);
3081 LOG(
llevError,
"init_weather_settings: worldmaptilesizex must be greater than 1, %d is invalid\n", size);
3085 int size = atoi(cp);
3088 LOG(
llevError,
"init_weather_settings: worldmaptilesizey must be greater than 1, %d is invalid\n", size);
3095 LOG(
llevError,
"init_weather_settings: dynamiclevel must be at least 0, %d is invalid\n", lev);
3101 LOG(
llevError,
"init_weather_settings: line %s ends after specifier, skipping...\n",
buf);
3142 LOG(
llevError,
"Failed to open %s for writing.\n", filename);
3149 fprintf(fp,
"%d ",
weathermap[x][y].forestry);
3175 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3210 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3216 fprintf(fp,
"%d ",
weathermap[x][y].avgelev);
3245 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3276 snprintf(filename,
sizeof(filename),
"%s/temperaturemap",
settings->
localdir);
3279 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3309 snprintf(filename,
sizeof(filename),
"%s/rainfallmap",
settings->
localdir);
3312 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3318 fprintf(fp,
"%u ",
weathermap[x][y].rainfall);
3342 snprintf(filename,
sizeof(filename),
"%s/gulfstreammap",
settings->
localdir);
3345 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3385 snprintf(filename,
sizeof(filename),
"%s/windspeedmap",
settings->
localdir);
3388 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3394 fprintf(fp,
"%hd ",
weathermap[x][y].windspeed);
3421 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3424 LOG(
llevDebug,
"Writing wind direction map to file.\n");
3427 fprintf(fp,
"%d ",
weathermap[x][y].winddir);
3451 snprintf(filename,
sizeof(filename),
"%s/pressuremap",
settings->
localdir);
3454 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3460 fprintf(fp,
"%d ",
weathermap[x][y].pressure);
3483 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3486 LOG(
llevDebug,
"Writing sky conditions map to file.\n");
3566 int32_t min[8], max[8], avgrain, avgwind, realmaxwind;
3567 double scale[8], realscalewind;
3569 int64_t total_rainfall = 0;
3570 int64_t total_wind = 0;
3578 min[0] = -100; max[0] = 100;
3579 min[1] = 0; max[1] = 0;
3580 min[2] = 0; max[2] = 0;
3583 min[4] = 0; max[4] = 0;
3585 min[6] = 0; max[6] = 100;
3586 min[7] = -45; max[7] = 45;
3614 realscalewind = 255.0l/(max[4]);
3615 realmaxwind = max[4];
3617 for (x = 0; x < 8; x++) {
3618 scale[x] = 255.0l/(max[x]-min[x]);
3626 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3630 fprintf(fp,
"255\n");
3672 pressure =
MIN(255,
MAX(0, pressure));
3680 if (
speed < avgwind) {
3726 else if (temp < 20) {
3732 else if (temp < 30) {
3787 int trees, x, y, res;
3790 LOG(
llevDebug,
"Reading forestry data from %s...\n", filename);
3803 res = sscanf(
data,
"%d ", &trees);
3805 LOG(
llevError,
"Forestry data is corrupted and should be regenerated.\n"
3806 "Please delete %s/humidmap and restart the server at your earliest convenience to regenerate the forestry map.\n",
settings->
localdir);
3814 tmp = strpbrk(
data,
" \n");
3818 LOG(
llevError,
"Unexpected end of forestry file. Forestry file may need to be regenerated.\n"
3819 "Please delete %s/humidmap and restart the server at your earliest convenience to regenerate the forestry map.\n",
settings->
localdir);
3853 LOG(
llevDebug,
"Reading humidity data from %s...\n", filename);
3858 LOG(
llevInfo,
"Initializing humidity and elevation maps...\n");
3870 res = sscanf(
data,
"%d ", &hmd);
3872 LOG(
llevError,
"Humidity data is corrupted and cannot be loaded.\n"
3873 "Please delete %s and restart the server to regenerate humidity data.\n", filename);
3880 tmp = strpbrk(
data,
" \n");
3883 "Please delete %s and restart the server to regenerate humidity data.\n", filename);
3914 int x, y, elev, res;
3917 LOG(
llevDebug,
"Reading elevation data from %s...\n", filename);
3929 res = sscanf(
data,
"%d ", &elev);
3931 LOG(
llevError,
"Elevation data is corrupted and cannot be loaded.\n"
3932 "Please delete %s/humidmap and restart your server to regenerate elevation data.\n",
settings->
localdir);
3940 tmp = strpbrk(
data,
" \n");
3942 LOG(
llevError,
"Unexpected end of file in elevation data.\n"
3943 "Please delete %s/humidmap and restart your server to regenerate elevation data.\n",
settings->
localdir);
3976 LOG(
llevDebug,
"Reading water data from %s...\n", filename);
3988 res = sscanf(
data,
"%d ", &wtr);
3990 LOG(
llevError,
"Water map is corrupted and cannot be loaded.\n"
3991 "Please delete %s/humidmap and restart your server to regenerate the water map.\n",
settings->
localdir);
3998 tmp = strpbrk(
data,
" \n");
4000 LOG(
llevError,
"Unexpected end of file in water map.\n"
4001 "Please delete %s/humidmap and restart your server to regenerate the water map.\n",
settings->
localdir);
4032 int16_t temperature;
4034 snprintf(filename,
sizeof(filename),
"%s/temperaturemap",
settings->
localdir);
4035 LOG(
llevDebug,
"Reading temperature data from %s...\n", filename);
4050 res = sscanf(
data,
"%hd ", &temperature);
4052 LOG(
llevError,
"Temperature file is malformed, unable to load temps from file.\n");
4059 tmp = strpbrk(
data,
" \n");
4061 LOG(
llevError,
"Unexpected end of file in temperature map.\n");
4095 snprintf(filename,
sizeof(filename),
"%s/rainfallmap",
settings->
localdir);
4096 LOG(
llevDebug,
"Reading rainfall data from %s...\n", filename);
4113 LOG(
llevError,
"Rainfall file is corrupted, cannot load rainfall from file.\n");
4118 tmp = strpbrk(
data,
" \n");
4120 LOG(
llevError,
"Unexpected end of file in rainfall map.\n");
4152 snprintf(filename,
sizeof(filename),
"%s/gulfstreammap",
settings->
localdir);
4153 LOG(
llevDebug,
"Reading gulf stream data from %s...\n", filename);
4158 LOG(
llevInfo,
"Initializing gulf stream maps...\n");
4170 res = sscanf(
data,
"%d ", &
in);
4172 LOG(
llevError,
"Gulf stream speed definitions are malformed. Cannot load gulf stream from file.\n");
4178 tmp = strpbrk(
data,
" \n");
4180 LOG(
llevError,
"Unexpected end of file in gulfstream speed map.\n");
4194 res = sscanf(
data,
"%d ", &
in);
4196 LOG(
llevError,
"Gulf stream direction definitions are malformed. Cannot load gulf stream from file.\n");
4202 tmp = strpbrk(
data,
" \n");
4204 LOG(
llevError,
"Unexpected end of file in gulfstream direction map.\n");
4217 res = sscanf(
data,
"%d\n", &
in);
4219 LOG(
llevInfo,
"Gulf stream file lacks start position, and is assumed to be old; initializing it randomly.\n");
4249 snprintf(filename,
sizeof(filename),
"%s/windspeedmap",
settings->
localdir);
4250 LOG(
llevDebug,
"Reading wind speed data from %s...\n", filename);
4261 res = sscanf(
data,
"%hhd ", &spd);
4263 LOG(
llevError,
"Wind speed file is malformed. Cannot load wind speed file.\n");
4270 tmp = strpbrk(
data,
" \n");
4272 LOG(
llevError,
"Unexpected end of file in wind speed map.\n");
4304 LOG(
llevDebug,
"Reading wind direction data from %s...\n", filename);
4309 LOG(
llevInfo,
"Initializing wind direction and speed maps...\n");
4322 res = sscanf(
data,
"%d ", &
d);
4324 LOG(
llevError,
"Wind direction map is malformed. Could not load wind direction.\n");
4329 if (d < 1 || d > 8) {
4334 tmp = strpbrk(
data,
" \n");
4336 LOG(
llevError,
"Unexpected end of file in wind direction map.\n");
4368 snprintf(filename,
sizeof(filename),
"%s/pressuremap",
settings->
localdir);
4369 LOG(
llevDebug,
"Reading pressure data from %s...\n", filename);
4385 res = sscanf(
data,
"%hd ", &press);
4387 LOG(
llevError,
"Pressure map is malformed. Could not load pressure.\n");
4394 tmp = strpbrk(
data,
" \n");
4396 LOG(
llevError,
"Unexpected end of file in pressure map.\n");
4430 LOG(
llevDebug,
"Reading current weather position from %s...\n", filename);
4441 res = sscanf(
data,
"%d %d", &sx, &sy);
4446 LOG(
llevError,
"Weather position file was malformed. Using default position.\n");
4487 va_start(args,
type);
4488 code = va_arg(args,
int);
4494 va_arg(args,
object *);
4525 va_start(args,
type);
4526 code = va_arg(args,
int);
4584 va_start(args,
type);
4585 code = va_arg(args,
int);
4588 op = va_arg(args,
object *);
4618 if (pl->type ==
PLAYER) {
4619 pl->contr->do_los = 1;
4624 pl->contr->socket->update_look = 1;
4625 pl->contr->socket->look_position = 0;
4644 int wx, wy, temp, sky;
4649 "The weather is perpetually great around here.");
4653 if (op->
map == NULL)
4658 "You can't see the weather from here.");
4678 "Pressure: %d",
weathermap[wx][wy].pressure);
4681 "Avg Elevation: %d",
weathermap[wx][wy].avgelev);
4689 "It's currently %d degrees Centigrade out.", temp);
4694 buf =
"It is very dry.";
4696 buf =
"It is rather dry.";
4698 buf =
"It is very comfortable today.";
4700 buf =
"It is a bit muggy.";
4702 buf =
"It is muggy.";
4704 buf =
"It is uncomfortably muggy.";
4737 "There is a mild breeze coming from the %s.",
buf);
4740 "There is a strong breeze coming from the %s.",
buf);
4743 "There is a light wind coming from the %s.",
buf);
4746 "There is a strong wind coming from the %s.",
buf);
4749 "There is a heavy wind coming from the %s.",
buf);
4752 "The wind from the %s is incredibly strong!",
buf);
4767 buf =
"There isn't a cloud in the sky.";
4770 buf =
"There are a few light clouds in the sky";
4773 buf =
"The sky is cloudy and dreary.";
4776 buf =
"It is raining softly.";
4779 buf =
"It is raining.";
4782 buf =
"It is raining heavily.";
4785 buf =
"There is a heavy storm! You should go inside!";
4788 buf =
"It's foggy and miserable.";
4791 buf =
"It's hailing out! Take cover!";
4794 buf =
"Snow is gently falling from the sky.";
4797 buf =
"It is snowing out.";
4800 buf =
"Snow is falling very heavily.";
4803 buf =
"A full blown blizzard is in effect. You might want to take cover!";