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);
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;
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) {
1586 int avoid, temp, sky, gotsnow, nodstk;
1587 object *tmp, *oldsnow, *topfloor;
1588 archetype *at, *doublestack, *doublestack2;
1595 if (
rndm(0, 2) > 0) {
1637 if (tmp->arch->name != dungmag) {
1644 if (topfloor == NULL) {
1653 if (repl->special_snow != NULL) {
1654 at = repl->special_snow;
1656 if (repl->doublestack_arch != NULL && !nodstk) {
1657 doublestack = repl->doublestack_arch;
1663 if (gotsnow && at) {
1664 if (oldsnow->
arch == at) {
1671 doublestack2 = NULL;
1674 if (repl->doublestack_arch == NULL) {
1679 doublestack2 = repl->doublestack_arch;
1684 if (tmp != NULL && doublestack2 != NULL) {
1685 if (tmp->
arch == doublestack2) {
1694 if (doublestack != NULL) {
1704 if (repl->special_snow == NULL) {
1708 if (tmp->
arch == repl->special_snow) {
1732 if (tmp->
arch->
name == melt->tile) {
1733 at = melt->special_snow;
1783 int avoid, temp, sky, gotsnow, nodstk;
1784 object *tmp, *oldsnow, *topfloor;
1785 archetype *at, *doublestack, *doublestack2;
1792 if (
rndm(0, 2) > 0) {
1834 if (tmp->
arch->
name == melt->tile) {
1835 at = melt->special_snow;
1845 default: at = NULL;
break;
1853 default: at = NULL;
break;
1859 if (tmp->arch->name != dungmag) {
1866 if (topfloor == NULL) {
1875 if (repl->doublestack_arch != NULL && !nodstk) {
1876 doublestack = repl->doublestack_arch;
1881 if (gotsnow && at) {
1882 if (oldsnow->
arch == at) {
1888 doublestack2 = NULL;
1890 if (repl->doublestack_arch == NULL) {
1895 doublestack2 = repl->doublestack_arch;
1900 if (tmp != NULL && doublestack2 != NULL) {
1901 if (tmp->arch == doublestack2) {
1910 if (doublestack != NULL) {
1936 doublestack2 = NULL;
1938 if (repl->doublestack_arch == NULL) {
1943 doublestack2 = repl->doublestack_arch;
1947 if (tmp != NULL && doublestack2 != NULL) {
1948 if (tmp->
arch == doublestack2) {
1973 int x, y, i, wx, wy;
2069 int x, y, i, wx, wy;
2072 object *tmp, *doublestack;
2079 if (
rndm(0, 2) > 0) {
2277 if ((fp = fopen(filename,
"w")) == NULL) {
2278 LOG(
llevError,
"Cannot open %s for writing\n", filename);
2313 if (!
m || !
m->outdoor)
2336 if (windspeed*2 < wt)
2341 if (
rndm(0, windspeed)+
rndm(0, windspeed) < wt)
2382 int found, is_obj_name, tree_count;
2384 snprintf(filename,
sizeof(filename),
"%s/%s",
settings->
confdir, conf_filename);
2387 "init_config_vals: Could not open file %s. No forestry data is defined. %s\n",
2416 LOG(
llevError,
"init_config_vals: Malformed name entry in %s, line %ld.\n",
2422 found = sscanf(
line,
"%d, %d\n", &is_obj_name, &tree_count);
2425 LOG(
llevError,
"init_config_vals: Malformed forestry entry in %s, line %ld.\n",
2436 frst->
is_obj = is_obj_name;
2467 int found, is_effect;
2469 snprintf(filename,
sizeof(filename),
"%s/%s",
settings->
confdir, conf_filename);
2472 "init_weatheravoid: Could not open file %s. No weatheravoid data is defined. %s\n",
llevError);
2499 LOG(
llevError,
"init_weatheravoid: Malformed name entry in %s, line %ld.\n",
2505 found = sscanf(
line,
"%d\n", &is_effect);
2508 LOG(
llevError,
"init_weatheravoid: Malformed effect flag entry in %s, line %ld.\n",
2519 frst->
snow = is_effect;
2551 snprintf(filename,
sizeof(filename),
"%s/%s",
settings->
confdir, conf_filename);
2581 LOG(
llevError,
"init_weather_replace: Malformed name entry in %s, line %ld.\n",
2591 LOG(
llevError,
"init_weather_replace: Malformed replacement entry in %s, line %ld.\n",
2601 LOG(
llevError,
"init_weather_replace: Malformed doublestack entry in %s, line %ld.\n",
2610 LOG(
llevError,
"init_weatheravoid: Malformed archetype/object flag entry in %s, line %ld.\n",
2622 if (strcmp(repl,
"NONE") == 0)
2627 if (strcmp(doublestack,
"NONE") == 0)
2663 if (!
m || !tx || !ty)
2705 if (!
m || !water || !elev || !trees)
2741 int x, y, tx, ty, nx, ny, ax, ay, j;
2746 int water, space, trees;
2757 water = space = trees = 0;
2765 for (nx = 0, ax = tx; nx < spwtx && ax <
wset.
worldmaptilesizex && space < spwtx*spwty; ax++, nx++) {
2766 for (ny = 0, ay = ty; ny < spwty && ay <
wset.
worldmaptilesizey && space < spwtx*spwty; ay++, ny++, space++) {
2779 if (space < spwtx*spwty) {
2790 for (nx = 0, ax = tx; nx < spwtx && ax <
wset.
worldmaptilesizex && space < spwtx*spwty; ax++, nx++) {
2791 for (ny = j, ay =
MAX(0, ty-(spwty-1)); ny < spwty && ay <= ty && space < spwtx*spwty; space++, ay++, ny++) {
2805 for (ax =
MAX(0, tx-(spwtx-1)); nx < spwtx && ax <= tx && space < spwtx*spwty; ax++, nx++) {
2806 for (ny = 0, ay = ty; ny < spwty && ay <
wset.
worldmaptilesizey && space < spwtx*spwty; ay++, ny++, space++) {
2821 for (nx = 0, ax =
MAX(0, tx - (spwtx-1)); nx < spwtx && ax <= tx && space < spwtx*spwty; ax++, nx++) {
2822 for (ny = j, ay =
MAX(0, ty-(spwty-1)); ny < spwty && ay <= ty && space < spwtx*spwty; space++, ay++, ny++) {
2902 int x, y, tx, starty, ymul, diroffset,
dirdiff;
2934 switch (
rndm(0, 6)) {
3015 switch (
rndm(0, 3)) {
3018 case 2:
if (x) x--;
break;
3019 case 3:
if (y) y--;
break;
3031 n =
rndm(500, 2000);
3043 if ((fp = fopen(
buf,
"r")) == NULL) {
3051 if ((cp = strrchr(
buf,
'\n')) != NULL)
3061 if ((cp = strchr(
buf,
' ')) != NULL) {
3069 int size = atoi(cp);
3072 LOG(
llevError,
"init_weather_settings: worldmaptilesizex must be greater than 1, %d is invalid\n", size);
3076 int size = atoi(cp);
3079 LOG(
llevError,
"init_weather_settings: worldmaptilesizey must be greater than 1, %d is invalid\n", size);
3086 LOG(
llevError,
"init_weather_settings: dynamiclevel must be at least 0, %d is invalid\n", lev);
3092 LOG(
llevError,
"init_weather_settings: line %s ends after specifier, skipping...\n",
buf);
3133 LOG(
llevError,
"Failed to open %s for writing.\n", filename);
3140 fprintf(fp,
"%d ",
weathermap[x][y].forestry);
3166 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3201 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3207 fprintf(fp,
"%d ",
weathermap[x][y].avgelev);
3236 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3267 snprintf(filename,
sizeof(filename),
"%s/temperaturemap",
settings->
localdir);
3270 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3300 snprintf(filename,
sizeof(filename),
"%s/rainfallmap",
settings->
localdir);
3303 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3309 fprintf(fp,
"%u ",
weathermap[x][y].rainfall);
3333 snprintf(filename,
sizeof(filename),
"%s/gulfstreammap",
settings->
localdir);
3336 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3376 snprintf(filename,
sizeof(filename),
"%s/windspeedmap",
settings->
localdir);
3379 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3385 fprintf(fp,
"%hd ",
weathermap[x][y].windspeed);
3412 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3415 LOG(
llevDebug,
"Writing wind direction map to file.\n");
3418 fprintf(fp,
"%d ",
weathermap[x][y].winddir);
3442 snprintf(filename,
sizeof(filename),
"%s/pressuremap",
settings->
localdir);
3445 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3451 fprintf(fp,
"%d ",
weathermap[x][y].pressure);
3474 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3477 LOG(
llevDebug,
"Writing sky conditions map to file.\n");
3557 int32_t min[8], max[8], avgrain, avgwind;
3558 double scale[8], realscalewind;
3560 int64_t total_rainfall = 0;
3561 int64_t total_wind = 0;
3569 min[0] = -100; max[0] = 100;
3570 min[1] = 0; max[1] = 0;
3571 min[2] = 0; max[2] = 0;
3574 min[4] = 0; max[4] = 0;
3576 min[6] = 0; max[6] = 100;
3577 min[7] = -45; max[7] = 45;
3603 assert(avgrain >= 0);
3605 max[2] = avgrain >= 1 ? avgrain-1 : 0;
3606 realscalewind = 255.0l/(max[4]);
3607 max[4] = avgwind >= 1 ? avgwind-1 : 0;
3608 for (x = 0; x < 8; x++) {
3609 scale[x] = 255.0l/(max[x] != min[x] ? max[x] - min[x] : 1);
3617 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3621 fprintf(fp,
"255\n");
3646 if (
weathermap[x][y].rainfall >= uint32_t(avgrain)) {
3663 pressure =
MIN(255,
MAX(0, pressure));
3671 if (
speed < avgwind) {
3717 else if (temp < 20) {
3723 else if (temp < 30) {
3778 int trees, x, y, res;
3781 LOG(
llevDebug,
"Reading forestry data from %s...\n", filename);
3794 res = sscanf(
data,
"%d ", &trees);
3796 LOG(
llevError,
"Forestry data is corrupted and should be regenerated.\n"
3797 "Please delete %s/humidmap and restart the server at your earliest convenience to regenerate the forestry map.\n",
settings->
localdir);
3805 tmp = strpbrk(
data,
" \n");
3809 LOG(
llevError,
"Unexpected end of forestry file. Forestry file may need to be regenerated.\n"
3810 "Please delete %s/humidmap and restart the server at your earliest convenience to regenerate the forestry map.\n",
settings->
localdir);
3844 LOG(
llevDebug,
"Reading humidity data from %s...\n", filename);
3849 LOG(
llevInfo,
"Initializing humidity and elevation maps...\n");
3861 res = sscanf(
data,
"%d ", &hmd);
3863 LOG(
llevError,
"Humidity data is corrupted and cannot be loaded.\n"
3864 "Please delete %s and restart the server to regenerate humidity data.\n", filename);
3871 tmp = strpbrk(
data,
" \n");
3874 "Please delete %s and restart the server to regenerate humidity data.\n", filename);
3905 int x, y, elev, res;
3908 LOG(
llevDebug,
"Reading elevation data from %s...\n", filename);
3920 res = sscanf(
data,
"%d ", &elev);
3922 LOG(
llevError,
"Elevation data is corrupted and cannot be loaded.\n"
3923 "Please delete %s/humidmap and restart your server to regenerate elevation data.\n",
settings->
localdir);
3931 tmp = strpbrk(
data,
" \n");
3933 LOG(
llevError,
"Unexpected end of file in elevation data.\n"
3934 "Please delete %s/humidmap and restart your server to regenerate elevation data.\n",
settings->
localdir);
3967 LOG(
llevDebug,
"Reading water data from %s...\n", filename);
3979 res = sscanf(
data,
"%d ", &wtr);
3981 LOG(
llevError,
"Water map is corrupted and cannot be loaded.\n"
3982 "Please delete %s/humidmap and restart your server to regenerate the water map.\n",
settings->
localdir);
3989 tmp = strpbrk(
data,
" \n");
3991 LOG(
llevError,
"Unexpected end of file in water map.\n"
3992 "Please delete %s/humidmap and restart your server to regenerate the water map.\n",
settings->
localdir);
4023 int16_t temperature;
4025 snprintf(filename,
sizeof(filename),
"%s/temperaturemap",
settings->
localdir);
4026 LOG(
llevDebug,
"Reading temperature data from %s...\n", filename);
4041 res = sscanf(
data,
"%hd ", &temperature);
4043 LOG(
llevError,
"Temperature file is malformed, unable to load temps from file.\n");
4050 tmp = strpbrk(
data,
" \n");
4052 LOG(
llevError,
"Unexpected end of file in temperature map.\n");
4086 snprintf(filename,
sizeof(filename),
"%s/rainfallmap",
settings->
localdir);
4087 LOG(
llevDebug,
"Reading rainfall data from %s...\n", filename);
4104 LOG(
llevError,
"Rainfall file is corrupted, cannot load rainfall from file.\n");
4109 tmp = strpbrk(
data,
" \n");
4111 LOG(
llevError,
"Unexpected end of file in rainfall map.\n");
4143 snprintf(filename,
sizeof(filename),
"%s/gulfstreammap",
settings->
localdir);
4144 LOG(
llevDebug,
"Reading gulf stream data from %s...\n", filename);
4149 LOG(
llevInfo,
"Initializing gulf stream maps...\n");
4161 res = sscanf(
data,
"%d ", &
in);
4163 LOG(
llevError,
"Gulf stream speed definitions are malformed. Cannot load gulf stream from file.\n");
4169 tmp = strpbrk(
data,
" \n");
4171 LOG(
llevError,
"Unexpected end of file in gulfstream speed map.\n");
4185 res = sscanf(
data,
"%d ", &
in);
4187 LOG(
llevError,
"Gulf stream direction definitions are malformed. Cannot load gulf stream from file.\n");
4193 tmp = strpbrk(
data,
" \n");
4195 LOG(
llevError,
"Unexpected end of file in gulfstream direction map.\n");
4208 res = sscanf(
data,
"%d\n", &
in);
4210 LOG(
llevInfo,
"Gulf stream file lacks start position, and is assumed to be old; initializing it randomly.\n");
4240 snprintf(filename,
sizeof(filename),
"%s/windspeedmap",
settings->
localdir);
4241 LOG(
llevDebug,
"Reading wind speed data from %s...\n", filename);
4252 res = sscanf(
data,
"%hhd ", &spd);
4254 LOG(
llevError,
"Wind speed file is malformed. Cannot load wind speed file.\n");
4261 tmp = strpbrk(
data,
" \n");
4263 LOG(
llevError,
"Unexpected end of file in wind speed map.\n");
4295 LOG(
llevDebug,
"Reading wind direction data from %s...\n", filename);
4300 LOG(
llevInfo,
"Initializing wind direction and speed maps...\n");
4313 res = sscanf(
data,
"%d ", &
d);
4315 LOG(
llevError,
"Wind direction map is malformed. Could not load wind direction.\n");
4320 if (d < 1 || d > 8) {
4325 tmp = strpbrk(
data,
" \n");
4327 LOG(
llevError,
"Unexpected end of file in wind direction map.\n");
4359 snprintf(filename,
sizeof(filename),
"%s/pressuremap",
settings->
localdir);
4360 LOG(
llevDebug,
"Reading pressure data from %s...\n", filename);
4376 res = sscanf(
data,
"%hd ", &press);
4378 LOG(
llevError,
"Pressure map is malformed. Could not load pressure.\n");
4385 tmp = strpbrk(
data,
" \n");
4387 LOG(
llevError,
"Unexpected end of file in pressure map.\n");
4421 LOG(
llevDebug,
"Reading current weather position from %s...\n", filename);
4432 res = sscanf(
data,
"%d %d", &sx, &sy);
4437 LOG(
llevError,
"Weather position file was malformed. Using default position.\n");
4478 va_start(args,
type);
4479 code = va_arg(args,
int);
4485 va_arg(args,
object *);
4516 va_start(args,
type);
4517 code = va_arg(args,
int);
4575 va_start(args,
type);
4576 code = va_arg(args,
int);
4579 op = va_arg(args,
object *);
4609 if (pl->type ==
PLAYER) {
4610 pl->contr->do_los = 1;
4615 pl->contr->socket->update_look = 1;
4616 pl->contr->socket->look_position = 0;
4635 int wx, wy, temp, sky;
4640 "The weather is perpetually great around here.");
4644 if (op->
map == NULL)
4649 "You can't see the weather from here.");
4669 "Pressure: %d",
weathermap[wx][wy].pressure);
4672 "Avg Elevation: %d",
weathermap[wx][wy].avgelev);
4680 "It's currently %d degrees Centigrade out.", temp);
4685 buf =
"It is very dry.";
4687 buf =
"It is rather dry.";
4689 buf =
"It is very comfortable today.";
4691 buf =
"It is a bit muggy.";
4693 buf =
"It is muggy.";
4695 buf =
"It is uncomfortably muggy.";
4728 "There is a mild breeze coming from the %s.",
buf);
4731 "There is a strong breeze coming from the %s.",
buf);
4734 "There is a light wind coming from the %s.",
buf);
4737 "There is a strong wind coming from the %s.",
buf);
4740 "There is a heavy wind coming from the %s.",
buf);
4743 "The wind from the %s is incredibly strong!",
buf);
4758 buf =
"There isn't a cloud in the sky.";
4761 buf =
"There are a few light clouds in the sky";
4764 buf =
"The sky is cloudy and dreary.";
4767 buf =
"It is raining softly.";
4770 buf =
"It is raining.";
4773 buf =
"It is raining heavily.";
4776 buf =
"There is a heavy storm! You should go inside!";
4779 buf =
"It's foggy and miserable.";
4782 buf =
"It's hailing out! Take cover!";
4785 buf =
"Snow is gently falling from the sky.";
4788 buf =
"It is snowing out.";
4791 buf =
"Snow is falling very heavily.";
4794 buf =
"A full blown blizzard is in effect. You might want to take cover!";