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


version 1.16 version 1.17
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_weather_c =   * static char *rcsid_weather_c =
  *   "$Id: weather.c,v 1.16 2002/11/26 22:13:10 garbled Exp $";   *   "$Id: weather.c,v 1.17 2002/11/27 01:51:04 garbled Exp $";
  */   */
 /*  /*
     CrossFire, A Multiplayer game for X-windows      CrossFire, A Multiplayer game for X-windows
Line 117
 
Line 117
 };  };
   
 /*  /*
    * The table below is used to grow things on the map. See include/tod.h for
    * the meanings of all of the fields.
    */
   
   weather_grow_t weather_grow[] = {
       /* herb, tile, random, rfmin, rfmax, humin, humax, tempmin, tempmax, elevmin, elevmax */
       {"mint", "grass", 10, 14000, 60000, 30, 100, 10, 25, -100, 9999},
       {"mint", "brush", 8, 14000, 60000, 30, 100, 10, 25, -100, 9999},
       {NULL, NULL, 1, 0, 0, 0, 0, 0, 0, 0, 0}
   };
   
   /*
  * Set the darkness level for a map.  Requires the map pointer.   * Set the darkness level for a map.  Requires the map pointer.
  */   */
   
Line 1180
 
Line 1192
     let_it_snow(m, wx, wy, filename);      let_it_snow(m, wx, wy, filename);
     singing_in_the_rain(m, wx, wy, filename);      singing_in_the_rain(m, wx, wy, filename);
   
       if (settings.dynamiclevel < 3)
    return;
   
       plant_a_garden(m, wx, wy, filename);
   
 }  }
   
 /*  /*
Line 1573
 
Line 1590
     }      }
 }  }
   
   /*
    * Process growth.  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 plant_a_garden(mapstruct *m, int wx, int wy, char *filename)
   {
       int x, y, i;
       int avoid, two, temp, sky, gotsnow, found;
       object *ob, *tmp, *oldherb;
       archetype *at;
   
       for (x=0; x < settings.worldmaptilesizex; x++) {
    for (y=0; y < settings.worldmaptilesizey; y++) {
        (void)worldmap_to_weathermap(x, y, &wx, &wy, filename);
        ob = NULL;
        at = NULL;
        avoid = 0;
        two = 0;
        gotsnow = 0;
        temp = real_world_temperature(x, y, m);
        sky = weathermap[wx][wy].sky;
        (void)avoid_weather(&avoid, m, x, y, &gotsnow);
        if (!avoid) {
    for (i=0; weather_grow[i].herb != NULL; i++) {
        for (tmp=GET_MAP_OB(m, x, y); tmp; tmp = tmp->above) {
    if (strcmp(tmp->arch->name, weather_grow[i].herb) != 0)
        continue;
    /* we found there is a herb here allready */
    if (weathermap[wx][wy].rainfall < weather_grow[i].rfmin ||
        weathermap[wx][wy].rainfall > weather_grow[i].rfmax ||
        weathermap[wx][wy].humid < weather_grow[i].humin ||
        weathermap[wx][wy].humid > weather_grow[i].humax ||
        temp < weather_grow[i].tempmin ||
        temp > weather_grow[i].tempmax ||
        rndm(0, MIN(weather_grow[i].random/2, 1)) == 0) {
        /* the herb does not belong, randomly delete
          herbs to prevent overgrowth. */
        remove_ob(tmp);
        free_object(tmp);
        break;
    }
        }
        /* add a random factor */
        if (rndm(1, weather_grow[i].random) != 1)
    continue;
        /* we look up through two tiles for a matching tile */
        if (weather_grow[i].tile != NULL) {
    if (strcmp(GET_MAP_OB(m, x, y)->arch->name,
    weather_grow[i].tile) != 0)
        if (GET_MAP_OB(m, x, y)->above != NULL) {
    if (strcmp(GET_MAP_OB(m, x, y)->above->arch->name,
       weather_grow[i].tile) != 0)
        continue;
        } else
    continue;
        }
        if (weathermap[wx][wy].rainfall < weather_grow[i].rfmin ||
    weathermap[wx][wy].rainfall > weather_grow[i].rfmax)
    continue;
        if (weathermap[wx][wy].humid < weather_grow[i].humin ||
    weathermap[wx][wy].humid > weather_grow[i].humax)
    continue;
        if (temp < weather_grow[i].tempmin ||
    temp > weather_grow[i].tempmax)
    continue;
        if (GET_MAP_OB(m, x, y)->elevation < weather_grow[i].elevmin ||
    GET_MAP_OB(m, x, y)->elevation > weather_grow[i].elevmax)
    continue;
        /* we got this far.. must be a match */
        at = find_archetype(weather_grow[i].herb);
        break;
    }
    if (at != NULL) {
        ob = get_object();
        copy_object(&at->clone, ob);
        ob->x = x;
        ob->y = y;
        SET_FLAG(ob, FLAG_OVERLAY_FLOOR);
        insert_ob_in_map(ob, m, ob,
            INS_NO_MERGE | INS_NO_WALK_ON | INS_ABOVE_FLOOR_ONLY);
    }
        }
    }
       }
   }
   
 /* provide wx and wy. Will fill in with weathermap coordinates.  Requires  /* provide wx and wy. Will fill in with weathermap coordinates.  Requires
    the current mapname (must be a worldmap), and your coordinates on the     the current mapname (must be a worldmap), and your coordinates on the
    map.  returns -1 if you give it something it can't figure out. 0 normally.     map.  returns -1 if you give it something it can't figure out. 0 normally.


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

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