ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/weather.C
(Generate patch)

Comparing deliantra/server/server/weather.C (file contents):
Revision 1.7 by root, Thu Sep 14 22:34:05 2006 UTC vs.
Revision 1.8 by root, Sat Sep 16 22:24:13 2006 UTC

60static void write_rainfallmap (void); 60static void write_rainfallmap (void);
61static void read_rainfallmap (void); 61static void read_rainfallmap (void);
62static void init_rainfall (void); 62static void init_rainfall (void);
63static void init_weatheravoid (weather_avoids_t wa[]); 63static void init_weatheravoid (weather_avoids_t wa[]);
64static void perform_weather (void); 64static void perform_weather (void);
65static object *avoid_weather (int *av, mapstruct *m, int x, int y, int *gs, int grow); 65static object *avoid_weather (int *av, maptile *m, int x, int y, int *gs, int grow);
66static void calculate_temperature (mapstruct *m, int wx, int wy); 66static void calculate_temperature (maptile *m, int wx, int wy);
67static void let_it_snow (mapstruct *m, int wx, int wy); 67static void let_it_snow (maptile *m, int wx, int wy);
68static void singing_in_the_rain (mapstruct *m, int wx, int wy); 68static void singing_in_the_rain (maptile *m, int wx, int wy);
69static void plant_a_garden (mapstruct *m, int wx, int wy); 69static void plant_a_garden (maptile *m, int wx, int wy);
70static void change_the_world (mapstruct *m, int wx, int wy); 70static void change_the_world (maptile *m, int wx, int wy);
71 71
72//static void feather_map(mapstruct *m, int wx, int wy); 72//static void feather_map(maptile *m, int wx, int wy);
73static const char *weathermap_to_worldmap_corner (int wx, int wy, int *x, int *y, int dir); 73static const char *weathermap_to_worldmap_corner (int wx, int wy, int *x, int *y, int dir);
74static int polar_distance (int x, int y, int equator); 74static int polar_distance (int x, int y, int equator);
75static void update_humid (void); 75static void update_humid (void);
76static int humid_tile (int x, int y); 76static int humid_tile (int x, int y);
77static void temperature_calc (int x, int y, const timeofday_t * tod); 77static void temperature_calc (int x, int y, const timeofday_t * tod);
342/* 342/*
343 * Set the darkness level for a map. Requires the map pointer. 343 * Set the darkness level for a map. Requires the map pointer.
344 */ 344 */
345 345
346void 346void
347set_darkness_map (mapstruct *m) 347set_darkness_map (maptile *m)
348{ 348{
349 int i; 349 int i;
350 timeofday_t tod; 350 timeofday_t tod;
351 351
352 if (!m->outdoor) 352 if (!m->outdoor)
366 */ 366 */
367 367
368static void 368static void
369dawn_to_dusk (const timeofday_t * tod) 369dawn_to_dusk (const timeofday_t * tod)
370{ 370{
371 mapstruct *m; 371 maptile *m;
372 372
373 /* If the light level isn't changing, no reason to do all 373 /* If the light level isn't changing, no reason to do all
374 * the work below. 374 * the work below.
375 */ 375 */
376 if (season_timechange[tod->season][tod->hour] == 0) 376 if (season_timechange[tod->season][tod->hour] == 0)
1077 int x, y, tx, ty, nx, ny, ax, ay, j; 1077 int x, y, tx, ty, nx, ny, ax, ay, j;
1078 int spwtx, spwty; 1078 int spwtx, spwty;
1079 const char *mapname; 1079 const char *mapname;
1080 long int elev; 1080 long int elev;
1081 int water, space; 1081 int water, space;
1082 mapstruct *m; 1082 maptile *m;
1083 1083
1084 /* handling of this is kinda nasty. For that reason, 1084 /* handling of this is kinda nasty. For that reason,
1085 * we do the elevation here too. Not because it makes the 1085 * we do the elevation here too. Not because it makes the
1086 * code cleaner, or makes handling easier, but because I do *not* 1086 * code cleaner, or makes handling easier, but because I do *not*
1087 * want to maintain two of these nightmares. 1087 * want to maintain two of these nightmares.
1464 */ 1464 */
1465 1465
1466static void 1466static void
1467perform_weather (void) 1467perform_weather (void)
1468{ 1468{
1469 mapstruct *m; 1469 maptile *m;
1470 char filename[MAX_BUF]; 1470 char filename[MAX_BUF];
1471 FILE *fp; 1471 FILE *fp;
1472 1472
1473 if (!settings.dynamiclevel) 1473 if (!settings.dynamiclevel)
1474 return; 1474 return;
1521 */ 1521 */
1522 1522
1523void 1523void
1524weather_effect (const char *filename) 1524weather_effect (const char *filename)
1525{ 1525{
1526 mapstruct *m; 1526 maptile *m;
1527 int wx, wy, x, y; 1527 int wx, wy, x, y;
1528 1528
1529 /* if the dm shut off weather, go home */ 1529 /* if the dm shut off weather, go home */
1530 if (settings.dynamiclevel < 1) 1530 if (settings.dynamiclevel < 1)
1531 return; 1531 return;
1571 * Returns the object pointer for any snow item it found, so you can 1571 * Returns the object pointer for any snow item it found, so you can
1572 * destroy/melt it. 1572 * destroy/melt it.
1573 */ 1573 */
1574 1574
1575static object * 1575static object *
1576avoid_weather (int *av, mapstruct *m, int x, int y, int *gs, int grow) 1576avoid_weather (int *av, maptile *m, int x, int y, int *gs, int grow)
1577{ 1577{
1578 int avoid, gotsnow, i, n; 1578 int avoid, gotsnow, i, n;
1579 1579
1580 object *tmp; 1580 object *tmp;
1581 1581
1634 1634
1635/* Temperature is used in a lot of weather function. 1635/* Temperature is used in a lot of weather function.
1636 * This need to be precalculated before used. 1636 * This need to be precalculated before used.
1637 */ 1637 */
1638static void 1638static void
1639calculate_temperature (mapstruct *m, int wx, int wy) 1639calculate_temperature (maptile *m, int wx, int wy)
1640{ 1640{
1641 uint32 x, y; 1641 uint32 x, y;
1642 1642
1643 for (x = 0; x < settings.worldmaptilesizex; x++) 1643 for (x = 0; x < settings.worldmaptilesizex; x++)
1644 { 1644 {
1655 * filename is the pathname for the current map. This should be called from 1655 * filename is the pathname for the current map. This should be called from
1656 * weather_effect() 1656 * weather_effect()
1657 */ 1657 */
1658 1658
1659static void 1659static void
1660let_it_snow (mapstruct *m, int wx, int wy) 1660let_it_snow (maptile *m, int wx, int wy)
1661{ 1661{
1662 int x, y, i; 1662 int x, y, i;
1663 uint32 nx, ny, j, d; 1663 uint32 nx, ny, j, d;
1664 int avoid, two, temp, sky, gotsnow, found, nodstk; 1664 int avoid, two, temp, sky, gotsnow, found, nodstk;
1665 const char *doublestack, *doublestack2; 1665 const char *doublestack, *doublestack2;
1906 * filename is the pathname for the current map. This should be called from 1906 * filename is the pathname for the current map. This should be called from
1907 * weather_effect() 1907 * weather_effect()
1908 */ 1908 */
1909 1909
1910static void 1910static void
1911singing_in_the_rain (mapstruct *m, int wx, int wy) 1911singing_in_the_rain (maptile *m, int wx, int wy)
1912{ 1912{
1913 int x, y, i; 1913 int x, y, i;
1914 uint32 nx, ny, d, j; 1914 uint32 nx, ny, d, j;
1915 int avoid, two, temp, sky, gotsnow, found, nodstk; 1915 int avoid, two, temp, sky, gotsnow, found, nodstk;
1916 object *ob, *tmp, *oldsnow, *topfloor; 1916 object *ob, *tmp, *oldsnow, *topfloor;
2178 * filename is the pathname for the current map. This should be called from 2178 * filename is the pathname for the current map. This should be called from
2179 * weather_effect() 2179 * weather_effect()
2180 */ 2180 */
2181 2181
2182static void 2182static void
2183plant_a_garden (mapstruct *m, int wx, int wy) 2183plant_a_garden (maptile *m, int wx, int wy)
2184{ 2184{
2185 uint32 x, y, i; 2185 uint32 x, y, i;
2186 int avoid, two, temp, sky, gotsnow, found, days; 2186 int avoid, two, temp, sky, gotsnow, found, days;
2187 object *ob, *tmp; 2187 object *ob, *tmp;
2188 archetype *at; 2188 archetype *at;
2282 * the weathermap coordinates for the weathermap square we want to work on. 2282 * the weathermap coordinates for the weathermap square we want to work on.
2283 * This should be called from weather_effect() 2283 * This should be called from weather_effect()
2284 */ 2284 */
2285 2285
2286static void 2286static void
2287change_the_world (mapstruct *m, int wx, int wy) 2287change_the_world (maptile *m, int wx, int wy)
2288{ 2288{
2289 int x, y, i; 2289 int x, y, i;
2290 uint32 nx, ny, j, d; 2290 uint32 nx, ny, j, d;
2291 int avoid, two, temp, sky, gotsnow, found, days; 2291 int avoid, two, temp, sky, gotsnow, found, days;
2292 object *ob, *tmp, *doublestack; 2292 object *ob, *tmp, *doublestack;
2426 * the weathermap coordinates for the weathermap square we want to work on. 2426 * the weathermap coordinates for the weathermap square we want to work on.
2427 * This should be called from weather_effect() 2427 * This should be called from weather_effect()
2428 */ 2428 */
2429#if 0 2429#if 0
2430static void 2430static void
2431feather_map (mapstruct *m, int wx, int wy) 2431feather_map (maptile *m, int wx, int wy)
2432{ 2432{
2433 uint32 x, y, i, nx, ny, j; 2433 uint32 x, y, i, nx, ny, j;
2434 int avoid, two, gotsnow, nodstk; 2434 int avoid, two, gotsnow, nodstk;
2435 object *ob, *tmp, *oldsnow, *topfloor, *ntmp, *ntopfloor; 2435 object *ob, *tmp, *oldsnow, *topfloor, *ntmp, *ntopfloor;
2436 archetype *at; 2436 archetype *at;
2530 the current mapname (must be a worldmap), and your coordinates on the 2530 the current mapname (must be a worldmap), and your coordinates on the
2531 map. returns -1 if you give it something it can't figure out. 0 normally. 2531 map. returns -1 if you give it something it can't figure out. 0 normally.
2532*/ 2532*/
2533 2533
2534int 2534int
2535worldmap_to_weathermap (int x, int y, int *wx, int *wy, mapstruct *m) 2535worldmap_to_weathermap (int x, int y, int *wx, int *wy, maptile *m)
2536{ 2536{
2537 int spwtx, spwty; 2537 int spwtx, spwty;
2538 uint32 fx, fy; 2538 uint32 fx, fy;
2539 uint32 nx, ny; 2539 uint32 nx, ny;
2540 char *filename = m->path; 2540 char *filename = m->path;
2783/* Given a worldmap name, and x and y on that map, compute the temperature 2783/* Given a worldmap name, and x and y on that map, compute the temperature
2784 for a specific square. Used to normalize elevation. 2784 for a specific square. Used to normalize elevation.
2785*/ 2785*/
2786 2786
2787int 2787int
2788real_world_temperature (int x, int y, mapstruct *m) 2788real_world_temperature (int x, int y, maptile *m)
2789{ 2789{
2790 int wx, wy, temp, eleva, elevb; 2790 int wx, wy, temp, eleva, elevb;
2791 object *op; 2791 object *op;
2792 2792
2793 /*LOG(llevDebug, "real_world_temperature: worldmaptoweathermap : %s\n",m->path); */ 2793 /*LOG(llevDebug, "real_world_temperature: worldmaptoweathermap : %s\n",m->path); */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines