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);
534 int avoid, gotsnow, i;
554 if (avoid && gotsnow) {
573 if (avoid && gotsnow) {
617 #define WEATHER_OVERLAY 1
618 #define WEATHER_NO_FLOOR 2
619 #define WEATHER_NO_SAVE 4
688 while (*
line ==
' ' || *
line ==
',')
723 for (tx = -1; tx < 2; tx++) {
724 for (ty = -1; ty < 2; ty++) {
725 if (!(tx == 0 && ty == 0)) {
758 for (tx = -1; tx < 2; tx++) {
759 for (ty = -1; ty < 2; ty++) {
760 if (tx != 0 && ty != 0) {
828 int x, y, l, n, j, k, is_storm;
846 is_storm = (n < 1013 &&
rndm(1, 10) == 1);
847 for (j = x-2; j < x+2; j++) {
848 for (k = y-2; k < y+2; k++) {
876 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};
933 for (i = 0; i <= tod->
hour; i++) {
969 int wx, wy, temp, eleva, elevb, trees;
1000 elevb = eleva - elevb;
1029 int dist, equator, elev, n, trees;
1043 n -= (tod->
month*tdiff);
1074 else if (trees >= 30){
1104 int calc, inv_pressure;
1118 press_root = sqrt(inv_pressure);
1119 calc =
MAX(0,
MIN((
int)(max_root*100), (
int)(press_root *
weathermap[x][y].humid)));
1124 calc /= (int)(max_root*100 / 7) + 1;
1135 if (temp > 0 && temp < 5 &&
weathermap[x][y].humid > 95 &&
1139 if (temp > 0 && temp < 5 &&
weathermap[x][y].humid > 70 &&
1162 int buffer_pressure;
1173 for (x = xy-xy_eff; x < xy_eff; ++x) {
1202 static int humid_tile(
const int x,
const int y,
const int dark) {
1204 int ox = x, oy = y, humid, evap, tempeffect, lightness;
1233 tempeffect = light*light/4;
1236 tempeffect = light*light/5;
1243 tempeffect = light*4/5;
1247 tempeffect = light/2;
1251 tempeffect = light/3;
1256 tempeffect = light/5;
1267 evap =
MAX(0, evap);
1305 int x, y, tx, diroffset,
dirdiff, ystart, ydiff, ylimup, ylimlow;
1329 for (y = ystart; y > ylimlow && y < ylimup; y += ydiff) {
1361 if (
rndm(1, 1000) == 1) {
1381 if (
rndm(1, 75) <= 2) {
1508 if (
rndm(0, 99) + pct_precip >= 100) {
1513 if (temp < -2 || (temp <= 2 &&
rndm(0, 2+temp) - 2 <= 0)) {
1524 if (tmp->
arch == at) {
1528 else if ((tmp->
arch->
name == snowc && at->
name == rain) ||
1563 int x, y, temp, sky, wx, wy;
1567 for (x = 0; x <
m->width; ++x)
1568 for (y = 0; y <
m->height; ++y) {
1583 int x, y, i, wx, wy;
1585 int avoid, temp, sky, gotsnow,
found, nodstk;
1586 object *ob, *tmp, *oldsnow, *topfloor;
1587 archetype *at, *doublestack, *doublestack2;
1594 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;
1781 int x, y, i, wx, wy;
1783 int avoid, temp, sky, gotsnow, nodstk;
1784 object *ob, *tmp, *oldsnow, *topfloor;
1785 archetype *at, *doublestack, *doublestack2;
1792 if (
rndm(0, 2) > 0) {
1835 if (tmp->
arch->
name == melt->tile) {
1836 at = melt->special_snow;
1846 default: at = NULL;
break;
1854 default: at = NULL;
break;
1860 if (tmp->arch->name != dungmag) {
1867 if (topfloor == NULL) {
1876 if (repl->doublestack_arch != NULL && !nodstk) {
1877 doublestack = repl->doublestack_arch;
1882 if (gotsnow && at) {
1883 if (oldsnow->
arch == at) {
1889 doublestack2 = NULL;
1891 if (repl->doublestack_arch == NULL) {
1896 doublestack2 = repl->doublestack_arch;
1901 if (tmp != NULL && doublestack2 != NULL) {
1902 if (tmp->arch == doublestack2) {
1911 if (doublestack != NULL) {
1937 doublestack2 = NULL;
1939 if (repl->doublestack_arch == NULL) {
1944 doublestack2 = repl->doublestack_arch;
1948 if (tmp != NULL && doublestack2 != NULL) {
1949 if (tmp->
arch == doublestack2) {
1974 int x, y, i, wx, wy;
1975 int avoid, two, temp, sky, gotsnow,
found,
days;
2073 int x, y, i, wx, wy;
2075 int avoid, two, temp, sky, gotsnow,
found,
days;
2076 object *ob, *tmp, *doublestack;
2083 if (
rndm(0, 2) > 0) {
2284 if ((fp = fopen(filename,
"w")) == NULL) {
2285 LOG(
llevError,
"Cannot open %s for writing\n", filename);
2320 if (!
m || !
m->outdoor)
2343 if (windspeed*2 < wt)
2348 if (
rndm(0, windspeed)+
rndm(0, windspeed) < wt)
2389 int found, is_obj_name, tree_count;
2391 snprintf(filename,
sizeof(filename),
"%s/%s",
settings->
confdir, conf_filename);
2394 "init_config_vals: Could not open file %s. No forestry data is defined. %s\n",
2423 LOG(
llevError,
"init_config_vals: Malformed name entry in %s, line %ld.\n",
2429 found = sscanf(
line,
"%d, %d\n", &is_obj_name, &tree_count);
2432 LOG(
llevError,
"init_config_vals: Malformed forestry entry in %s, line %ld.\n",
2443 frst->
is_obj = is_obj_name;
2474 int found, is_effect;
2476 snprintf(filename,
sizeof(filename),
"%s/%s",
settings->
confdir, conf_filename);
2479 "init_weatheravoid: Could not open file %s. No weatheravoid data is defined. %s\n",
llevError);
2506 LOG(
llevError,
"init_weatheravoid: Malformed name entry in %s, line %ld.\n",
2512 found = sscanf(
line,
"%d\n", &is_effect);
2515 LOG(
llevError,
"init_weatheravoid: Malformed effect flag entry in %s, line %ld.\n",
2526 frst->
snow = is_effect;
2558 snprintf(filename,
sizeof(filename),
"%s/%s",
settings->
confdir, conf_filename);
2588 LOG(
llevError,
"init_weather_replace: Malformed name entry in %s, line %ld.\n",
2598 LOG(
llevError,
"init_weather_replace: Malformed replacement entry in %s, line %ld.\n",
2608 LOG(
llevError,
"init_weather_replace: Malformed doublestack entry in %s, line %ld.\n",
2617 LOG(
llevError,
"init_weatheravoid: Malformed archetype/object flag entry in %s, line %ld.\n",
2629 if (strcmp(repl,
"NONE") == 0)
2634 if (strcmp(doublestack,
"NONE") == 0)
2670 if (!
m || !tx || !ty)
2712 if (!
m || !water || !elev || !trees)
2749 int x, y, tx, ty, nx, ny, ax, ay, j;
2754 int water, space, trees;
2765 water = space = trees = 0;
2773 for (nx = 0, ax = tx; nx < spwtx && ax <
wset.
worldmaptilesizex && space < spwtx*spwty; ax++, nx++) {
2774 for (ny = 0, ay = ty; ny < spwty && ay <
wset.
worldmaptilesizey && space < spwtx*spwty; ay++, ny++, space++) {
2787 if (space < spwtx*spwty) {
2798 for (nx = 0, ax = tx; nx < spwtx && ax <
wset.
worldmaptilesizex && space < spwtx*spwty; ax++, nx++) {
2799 for (ny = j, ay =
MAX(0, ty-(spwty-1)); ny < spwty && ay <= ty && space < spwtx*spwty; space++, ay++, ny++) {
2813 for (ax =
MAX(0, tx-(spwtx-1)); nx < spwtx && ax <= tx && space < spwtx*spwty; ax++, nx++) {
2814 for (ny = 0, ay = ty; ny < spwty && ay <
wset.
worldmaptilesizey && space < spwtx*spwty; ay++, ny++, space++) {
2829 for (nx = 0, ax =
MAX(0, tx - (spwtx-1)); nx < spwtx && ax <= tx && space < spwtx*spwty; ax++, nx++) {
2830 for (ny = j, ay =
MAX(0, ty-(spwty-1)); ny < spwty && ay <= ty && space < spwtx*spwty; space++, ay++, ny++) {
2910 int x, y, tx, starty, ymul, diroffset,
dirdiff;
2942 switch (
rndm(0, 6)) {
3023 switch (
rndm(0, 3)) {
3026 case 2:
if (x) x--;
break;
3027 case 3:
if (y) y--;
break;
3039 n =
rndm(500, 2000);
3052 if ((fp = fopen(
buf,
"r")) == NULL) {
3060 if ((cp = strrchr(
buf,
'\n')) != NULL)
3070 if ((cp = strchr(
buf,
' ')) != NULL) {
3080 int size = atoi(cp);
3083 LOG(
llevError,
"load_settings: worldmaptilesizex must be greater than 1, %d is invalid\n", size);
3087 int size = atoi(cp);
3090 LOG(
llevError,
"load_settings: worldmaptilesizey must be greater than 1, %d is invalid\n", size);
3097 LOG(
llevError,
"load_settings: dynamiclevel must be at least 0, %d is invalid\n", lev);
3137 LOG(
llevError,
"Failed to open %s for writing.\n", filename);
3144 fprintf(fp,
"%d ",
weathermap[x][y].forestry);
3170 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3205 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3211 fprintf(fp,
"%d ",
weathermap[x][y].avgelev);
3240 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3271 snprintf(filename,
sizeof(filename),
"%s/temperaturemap",
settings->
localdir);
3274 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3304 snprintf(filename,
sizeof(filename),
"%s/rainfallmap",
settings->
localdir);
3307 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3313 fprintf(fp,
"%u ",
weathermap[x][y].rainfall);
3337 snprintf(filename,
sizeof(filename),
"%s/gulfstreammap",
settings->
localdir);
3340 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3380 snprintf(filename,
sizeof(filename),
"%s/windspeedmap",
settings->
localdir);
3383 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3389 fprintf(fp,
"%hd ",
weathermap[x][y].windspeed);
3416 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3419 LOG(
llevDebug,
"Writing wind direction map to file.\n");
3422 fprintf(fp,
"%d ",
weathermap[x][y].winddir);
3446 snprintf(filename,
sizeof(filename),
"%s/pressuremap",
settings->
localdir);
3449 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3455 fprintf(fp,
"%d ",
weathermap[x][y].pressure);
3478 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3481 LOG(
llevDebug,
"Writing sky conditions map to file.\n");
3561 int32_t min[8], max[8], avgrain, avgwind, realmaxwind;
3562 double scale[8], realscalewind;
3564 int64_t total_rainfall = 0;
3565 int64_t total_wind = 0;
3573 min[0] = -100; max[0] = 100;
3574 min[1] = 0; max[1] = 0;
3575 min[2] = 0; max[2] = 0;
3578 min[4] = 0; max[4] = 0;
3580 min[6] = 0; max[6] = 100;
3581 min[7] = -45; max[7] = 45;
3609 realscalewind = 255.0l/(max[4]);
3610 realmaxwind = max[4];
3612 for (x = 0; x < 8; x++) {
3613 scale[x] = 255.0l/(max[x]-min[x]);
3621 LOG(
llevError,
"Cannot open %s for writing\n", filename);
3625 fprintf(fp,
"255\n");
3667 pressure =
MIN(255,
MAX(0, pressure));
3675 if (
speed < avgwind) {
3721 else if (temp < 20) {
3727 else if (temp < 30) {
3782 int trees, x, y, res;
3785 LOG(
llevDebug,
"Reading forestry data from %s...\n", filename);
3798 res = sscanf(
data,
"%d ", &trees);
3800 LOG(
llevError,
"Forestry data is corrupted and should be regenerated.\n"
3801 "Please delete %s/humidmap and restart the server at your earliest convenience to regenerate the forestry map.\n",
settings->
localdir);
3809 tmp = strpbrk(
data,
" \n");
3813 LOG(
llevError,
"Unexpected end of forestry file. Forestry file may need to be regenerated.\n"
3814 "Please delete %s/humidmap and restart the server at your earliest convenience to regenerate the forestry map.\n",
settings->
localdir);
3848 LOG(
llevDebug,
"Reading humidity data from %s...\n", filename);
3853 LOG(
llevInfo,
"Initializing humidity and elevation maps...\n");
3865 res = sscanf(
data,
"%d ", &hmd);
3867 LOG(
llevError,
"Humidity data is corrupted and cannot be loaded.\n"
3868 "Please delete %s and restart the server to regenerate humidity data.\n", filename);
3875 tmp = strpbrk(
data,
" \n");
3878 "Please delete %s and restart the server to regenerate humidity data.\n", filename);
3909 int x, y, elev, res;
3912 LOG(
llevDebug,
"Reading elevation data from %s...\n", filename);
3924 res = sscanf(
data,
"%d ", &elev);
3926 LOG(
llevError,
"Elevation data is corrupted and cannot be loaded.\n"
3927 "Please delete %s/humidmap and restart your server to regenerate elevation data.\n",
settings->
localdir);
3935 tmp = strpbrk(
data,
" \n");
3937 LOG(
llevError,
"Unexpected end of file in elevation data.\n"
3938 "Please delete %s/humidmap and restart your server to regenerate elevation data.\n",
settings->
localdir);
3971 LOG(
llevDebug,
"Reading water data from %s...\n", filename);
3983 res = sscanf(
data,
"%d ", &wtr);
3985 LOG(
llevError,
"Water map is corrupted and cannot be loaded.\n"
3986 "Please delete %s/humidmap and restart your server to regenerate the water map.\n",
settings->
localdir);
3993 tmp = strpbrk(
data,
" \n");
3995 LOG(
llevError,
"Unexpected end of file in water map.\n"
3996 "Please delete %s/humidmap and restart your server to regenerate the water map.\n",
settings->
localdir);
4027 int16_t temperature;
4029 snprintf(filename,
sizeof(filename),
"%s/temperaturemap",
settings->
localdir);
4030 LOG(
llevDebug,
"Reading temperature data from %s...\n", filename);
4045 res = sscanf(
data,
"%hd ", &temperature);
4047 LOG(
llevError,
"Temperature file is malformed, unable to load temps from file.\n");
4054 tmp = strpbrk(
data,
" \n");
4056 LOG(
llevError,
"Unexpected end of file in temperature map.\n");
4090 snprintf(filename,
sizeof(filename),
"%s/rainfallmap",
settings->
localdir);
4091 LOG(
llevDebug,
"Reading rainfall data from %s...\n", filename);
4108 LOG(
llevError,
"Rainfall file is corrupted, cannot load rainfall from file.\n");
4113 tmp = strpbrk(
data,
" \n");
4115 LOG(
llevError,
"Unexpected end of file in rainfall map.\n");
4147 snprintf(filename,
sizeof(filename),
"%s/gulfstreammap",
settings->
localdir);
4148 LOG(
llevDebug,
"Reading gulf stream data from %s...\n", filename);
4153 LOG(
llevInfo,
"Initializing gulf stream maps...\n");
4165 res = sscanf(
data,
"%d ", &
in);
4167 LOG(
llevError,
"Gulf stream speed definitions are malformed. Cannot load gulf stream from file.\n");
4173 tmp = strpbrk(
data,
" \n");
4175 LOG(
llevError,
"Unexpected end of file in gulfstream speed map.\n");
4189 res = sscanf(
data,
"%d ", &
in);
4191 LOG(
llevError,
"Gulf stream direction definitions are malformed. Cannot load gulf stream from file.\n");
4197 tmp = strpbrk(
data,
" \n");
4199 LOG(
llevError,
"Unexpected end of file in gulfstream direction map.\n");
4212 res = sscanf(
data,
"%d\n", &
in);
4214 LOG(
llevInfo,
"Gulf stream file lacks start position, and is assumed to be old; initializing it randomly.\n");
4244 snprintf(filename,
sizeof(filename),
"%s/windspeedmap",
settings->
localdir);
4245 LOG(
llevDebug,
"Reading wind speed data from %s...\n", filename);
4256 res = sscanf(
data,
"%hhd ", &spd);
4258 LOG(
llevError,
"Wind speed file is malformed. Cannot load wind speed file.\n");
4265 tmp = strpbrk(
data,
" \n");
4267 LOG(
llevError,
"Unexpected end of file in wind speed map.\n");
4299 LOG(
llevDebug,
"Reading wind direction data from %s...\n", filename);
4304 LOG(
llevInfo,
"Initializing wind direction and speed maps...\n");
4317 res = sscanf(
data,
"%d ", &
d);
4319 LOG(
llevError,
"Wind direction map is malformed. Could not load wind direction.\n");
4324 if (d < 1 || d > 8) {
4329 tmp = strpbrk(
data,
" \n");
4331 LOG(
llevError,
"Unexpected end of file in wind direction map.\n");
4363 snprintf(filename,
sizeof(filename),
"%s/pressuremap",
settings->
localdir);
4364 LOG(
llevDebug,
"Reading pressure data from %s...\n", filename);
4380 res = sscanf(
data,
"%hd ", &press);
4382 LOG(
llevError,
"Pressure map is malformed. Could not load pressure.\n");
4389 tmp = strpbrk(
data,
" \n");
4391 LOG(
llevError,
"Unexpected end of file in pressure map.\n");
4425 LOG(
llevDebug,
"Reading current weather position from %s...\n", filename);
4436 res = sscanf(
data,
"%d %d", &sx, &sy);
4441 LOG(
llevError,
"Weather position file was malformed. Using default position.\n");
4482 va_start(args,
type);
4483 code = va_arg(args,
int);
4489 va_arg(args,
object *);
4520 va_start(args,
type);
4521 code = va_arg(args,
int);
4579 va_start(args,
type);
4580 code = va_arg(args,
int);
4583 op = va_arg(args,
object *);
4613 if (pl->type ==
PLAYER) {
4614 pl->contr->do_los = 1;
4619 pl->contr->socket->update_look = 1;
4620 pl->contr->socket->look_position = 0;
4639 int wx, wy, temp, sky;
4644 "The weather is perpetually great around here.");
4648 if (op->
map == NULL)
4653 "You can't see the weather from here.");
4673 "Pressure: %d",
weathermap[wx][wy].pressure);
4676 "Avg Elevation: %d",
weathermap[wx][wy].avgelev);
4684 "It's currently %d degrees Centigrade out.", temp);
4689 buf =
"It is very dry.";
4691 buf =
"It is rather dry.";
4693 buf =
"It is very comfortable today.";
4695 buf =
"It is a bit muggy.";
4697 buf =
"It is muggy.";
4699 buf =
"It is uncomfortably muggy.";
4732 "There is a mild breeze coming from the %s.",
buf);
4735 "There is a strong breeze coming from the %s.",
buf);
4738 "There is a light wind coming from the %s.",
buf);
4741 "There is a strong wind coming from the %s.",
buf);
4744 "There is a heavy wind coming from the %s.",
buf);
4747 "The wind from the %s is incredibly strong!",
buf);
4762 buf =
"There isn't a cloud in the sky.";
4765 buf =
"There are a few light clouds in the sky";
4768 buf =
"The sky is cloudy and dreary.";
4771 buf =
"It is raining softly.";
4774 buf =
"It is raining.";
4777 buf =
"It is raining heavily.";
4780 buf =
"There is a heavy storm! You should go inside!";
4783 buf =
"It's foggy and miserable.";
4786 buf =
"It's hailing out! Take cover!";
4789 buf =
"Snow is gently falling from the sky.";
4792 buf =
"It is snowing out.";
4795 buf =
"Snow is falling very heavily.";
4798 buf =
"A full blown blizzard is in effect. You might want to take cover!";