Difference for server/weather.c from version 1.15 to 1.16


version 1.15 version 1.16
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_weather_c =   * static char *rcsid_weather_c =
  *   "$Id: weather.c,v 1.15 2002/11/26 21:53:29 garbled Exp $";   *   "$Id: weather.c,v 1.16 2002/11/26 22:13:10 garbled Exp $";
  */   */
 /*  /*
     CrossFire, A Multiplayer game for X-windows      CrossFire, A Multiplayer game for X-windows
Line 116
 
Line 116
     {NULL, NULL, NULL, 0},      {NULL, NULL, NULL, 0},
 };  };
   
   /*
    * Set the darkness level for a map.  Requires the map pointer.
    */
   
 void set_darkness_map(mapstruct *m)  void set_darkness_map(mapstruct *m)
 {  {
     int i;      int i;
Line 132
 
Line 136
  change_map_light(m, season_timechange[tod.season][i]);   change_map_light(m, season_timechange[tod.season][i]);
 }  }
   
   /*
    * Compute the darkness level for all maps in the game.  Requires the
    * time of day as an argument.
    */
   
 void dawn_to_dusk(timeofday_t *tod)  void dawn_to_dusk(timeofday_t *tod)
 {  {
     mapstruct *m;      mapstruct *m;
Line 740
 
Line 749
     fclose(fp);      fclose(fp);
 }  }
   
 /* initialize both humidity and elevation */  /*
    * initialize both humidity and elevation
    */
   
 void init_humid_elev()  void init_humid_elev()
 {  {
Line 997
 
Line 1008
 int wmperformstartx;  int wmperformstartx;
 int wmperformstarty;  int wmperformstarty;
   
   /*
    * This function initializes the weather system.  It should be called once,
    * at game startup only.
    */
   
   
 void init_weather()  void init_weather()
 {  {
     int x, y, tx, ty;      int x, y, tx, ty;
Line 1129
 
Line 1146
     fclose(fp);      fclose(fp);
 }  }
   
 /* perform actual effect of weather.  Should be called from perform_weather,  /*
    or when a map is loaded. (player enter map).  Filename is the name of   * perform actual effect of weather.  Should be called from perform_weather,
    the map.  The map *must allready be loaded*.   * or when a map is loaded. (player enter map).  Filename is the name of
    * the map.  The map *must allready be loaded*.
    This is where things like snow, herbs, earthly rototilling, etc should   *
    occur.   * This is where things like snow, herbs, earthly rototilling, etc should
    * occur.
 */  */
   
 void weather_effect(char *filename)  void weather_effect(char *filename)
Line 1164
 
Line 1182
   
 }  }
   
   /*
    * Check the current square to see if we should avoid this one for
    * weather processing.  Must pass av and gs, which will be filled in
    * with 1 or 0.  gs will be 1 if we found snow/rain here.  av will be
    * 1 if we should avoid processing this tile. (don't rain on lakes)
    * x and y are the coordinates inside the current map m.  Returns
    * the object pointer for any snow item it found, so you can destroy/melt it
    */
   
 object *avoid_weather(int *av, mapstruct *m, int x, int y, int *gs)  object *avoid_weather(int *av, mapstruct *m, int x, int y, int *gs)
 {  {
     int avoid, gotsnow, i;      int avoid, gotsnow, i;
Line 1189
 
Line 1216
     return tmp;      return tmp;
 }  }
   
   /*
    * Process snow.  m is the map we are currently processing.  wx and wy are
    * the weathermap coordinates for the weathermap square we want to work on.
    * filename is the pathname for the current map.  This should be called from
    * weather_effect()
    */
   
 void let_it_snow(mapstruct *m, int wx, int wy, char *filename)  void let_it_snow(mapstruct *m, int wx, int wy, char *filename)
 {  {
     int x, y, i;      int x, y, i;
Line 1367
 
Line 1401
     }      }
 }  }
   
   /*
    * Process rain.  m is the map we are currently processing.  wx and wy are
    * the weathermap coordinates for the weathermap square we want to work on.
    * filename is the pathname for the current map.  This should be called from
    * weather_effect()
    */
   
 void singing_in_the_rain(mapstruct *m, int wx, int wy, char *filename)  void singing_in_the_rain(mapstruct *m, int wx, int wy, char *filename)
 {  {
     int x, y, i;      int x, y, i;
Line 1609
 
Line 1650
     return(mapname);      return(mapname);
 }  }
   
   /*
    * Calculates the distance to the nearest pole. x,y are the weathermap
    * coordinates, equator is the current location of the equator.  returns
    * distance as an int.
    */
   
   
 int polar_distance(int x, int y, int equator)  int polar_distance(int x, int y, int equator)
 {  {
     if ((x+y) > equator) { /* south pole */      if ((x+y) > equator) { /* south pole */
Line 1622
 
Line 1670
     }      }
 }  }
   
 /* update the humidity */  /*
    * update the humidity for all weathermap tiles.
    */
   
 void update_humid()  void update_humid()
 {  {
Line 1633
 
Line 1683
      weathermap[x][y].humid = humid_tile(x, y);       weathermap[x][y].humid = humid_tile(x, y);
 }  }
   
 /* calculate the humidity of this tile */  /*
    * calculate the humidity of this tile.  x and y are the weathermap coordinates
    * we wish to calculate humidity for. Returns the humidity of the weathermap
    * square.
    */
   
 int humid_tile(int x, int y)  int humid_tile(int x, int y)
 {  {
Line 1671
 
Line 1725
     return humid;      return humid;
 }  }
   
 /* calculate temperature */  /*
    * calculate temperature of the weathermap square x,y.  Requires the current
    * time of day in *tod.
    */
   
 void temperature_calc(int x, int y, timeofday_t *tod)  void temperature_calc(int x, int y, timeofday_t *tod)
 {  {
Line 1703
 
Line 1760
 }  }
   
 /* Compute the real (adjusted) temperature of a given weathermap tile.  /* Compute the real (adjusted) temperature of a given weathermap tile.
    This takes into account the wind, base temp, sunlight, and other fun   * This takes into account the wind, base temp, sunlight, and other fun
    things.  Seasons are automatically handled by moving the equator.   * things.  Seasons are automatically handled by moving the equator.
    Elevation is partially considered in the base temp.   * Elevation is partially considered in the base temp. x and y are the
    * weathermap coordinates.
 */  */
   
 int real_temperature(int x, int y)  int real_temperature(int x, int y)
Line 1800
 
Line 1858
   
 }  }
   
 /* perform small randomizations in the pressure map.  Then, apply the  /*
    smoothing algorithim.. This causes the pressure to change very slowly   * perform small randomizations in the pressure map.  Then, apply the
    * smoothing algorithim.. This causes the pressure to change very slowly
 */  */
   
 void perform_pressure()  void perform_pressure()
Line 1833
 
Line 1892
 }  }
   
   
 /* is direction a similar to direction b? Find out in this exciting function  /*
    below.    * is direction a similar to direction b? Find out in this exciting function
    * below. Returns 1 if true, 0 for false.
  */   */
   
 int similar_direction(int a, int b)  int similar_direction(int a, int b)
Line 1857
 
Line 1917
 }  }
   
 /*  /*
    It doesn't really smooth it as such.  The main function of this is to   * It doesn't really smooth it as such.  The main function of this is to
    apply the pressuremap to the wind direction and speed.  Then, we run   * apply the pressuremap to the wind direction and speed.  Then, we run
    a quick pass to update the windspeed.   * a quick pass to update the windspeed.
 */  */
   
 void smooth_wind()  void smooth_wind()
Line 1917
 
Line 1977
  }   }
 }  }
   
   /*
    * Plot the gulfstream map over the wind map.  This is done after the wind,
    * to avoid the windsmoothing scrambling the jet stream.
    */
   
 void plot_gulfstream()  void plot_gulfstream()
 {  {
     int x, y, tx;      int x, y, tx;
Line 1997
 
Line 2062
   
 }  }
   
 /* let the madness, begin. */  /*
    * let the madness, begin.
    *
    * This function is the one that ties everything together.  Here we loop
    * over all the weathermaps, and compare the various conditions we have
    * calculated up to now, to figure out what the sky conditions are for this
    * square.
    */
   
 void compute_sky()  void compute_sky()
 {  {
Line 2090
 
Line 2162
     }      }
 }  }
   
   /*
    * Keep track of how much rain has fallen in a given weathermap square.
    */
   
 void process_rain()  void process_rain()
 {  {
     int x, y, rain;      int x, y, rain;


Legend:
line(s) removed in v.1.15 
line(s) changed
 line(s) added in v.1.16

File made using version 1.98 of cvs2html by leaf at 2011-07-21 17:53