Difference for server/weather.c from version 1.35 to 1.36


version 1.35 version 1.36
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_weather_c =   * static char *rcsid_weather_c =
  *   "$Id: weather.c,v 1.35 2003/09/26 06:12:07 mwedel Exp $";   *   "$Id: weather.c,v 1.36 2005/03/24 21:07:47 tchize Exp $";
  */   */
 /*  /*
     CrossFire, A Multiplayer game for X-windows      CrossFire, A Multiplayer game for X-windows
Line 969
 
Line 969
       space < spwtx*spwty); ax++,nx++) {        space < spwtx*spwty); ax++,nx++) {
  for (ny=0,ay=ty; (ny < spwty && ay < settings.worldmaptilesizey &&   for (ny=0,ay=ty; (ny < spwty && ay < settings.worldmaptilesizey &&
  space < spwtx*spwty);   space < spwtx*spwty);
       ay++,ny++,space++) {        ay++,ny++,space++)
        if(GET_MAP_OB(m, ax, ay)){
      if (QUERY_FLAG(GET_MAP_OB(m, ax, ay), FLAG_IS_WATER))       if (QUERY_FLAG(GET_MAP_OB(m, ax, ay), FLAG_IS_WATER))
  water++;   water++;
      elev += GET_MAP_OB(m, ax, ay)->elevation;       elev += GET_MAP_OB(m, ax, ay)->elevation;
Line 990
 
Line 991
       space < spwtx*spwty); ax++,nx++) {        space < spwtx*spwty); ax++,nx++) {
  for (ny=j,ay=MAX(0, ty - (spwty-1)); (ny < spwty && ay <= ty &&   for (ny=j,ay=MAX(0, ty - (spwty-1)); (ny < spwty && ay <= ty &&
  space < spwtx*spwty);   space < spwtx*spwty);
       space++,ay++,ny++) {        space++,ay++,ny++)
        if(GET_MAP_OB(m, ax, ay)){
      if (QUERY_FLAG(GET_MAP_OB(m, ax, ay), FLAG_IS_WATER))       if (QUERY_FLAG(GET_MAP_OB(m, ax, ay), FLAG_IS_WATER))
  water++;   water++;
      elev += GET_MAP_OB(m, ax, ay)->elevation;       elev += GET_MAP_OB(m, ax, ay)->elevation;
Line 1010
 
Line 1012
       space < spwtx*spwty); ax++,nx++) {        space < spwtx*spwty); ax++,nx++) {
  for (ny=0,ay=ty; (ny < spwty && ay < settings.worldmaptilesizey &&   for (ny=0,ay=ty; (ny < spwty && ay < settings.worldmaptilesizey &&
  space < spwtx*spwty);   space < spwtx*spwty);
       ay++,ny++,space++) {        ay++,ny++,space++)
        if(GET_MAP_OB(m, ax, ay)){
      if (QUERY_FLAG(GET_MAP_OB(m, ax, ay), FLAG_IS_WATER))       if (QUERY_FLAG(GET_MAP_OB(m, ax, ay), FLAG_IS_WATER))
  water++;   water++;
      elev += GET_MAP_OB(m, ax, ay)->elevation;       elev += GET_MAP_OB(m, ax, ay)->elevation;
Line 1030
 
Line 1033
       space < spwtx*spwty); ax++,nx++) {        space < spwtx*spwty); ax++,nx++) {
  for (ny=0,ay=MAX(0, ty - (spwty-1)); (ny < spwty && ay <= ty &&   for (ny=0,ay=MAX(0, ty - (spwty-1)); (ny < spwty && ay <= ty &&
  space < spwtx*spwty);   space < spwtx*spwty);
       space++,ay++,ny++) {        space++,ay++,ny++)
        if(GET_MAP_OB(m, ax, ay)){
      if (QUERY_FLAG(GET_MAP_OB(m, ax, ay), FLAG_IS_WATER))       if (QUERY_FLAG(GET_MAP_OB(m, ax, ay), FLAG_IS_WATER))
  water++;   water++;
      elev += GET_MAP_OB(m, ax, ay)->elevation;       elev += GET_MAP_OB(m, ax, ay)->elevation;
Line 1619
 
Line 1623
  remove_ob(tmp);   remove_ob(tmp);
  free_object(tmp);   free_object(tmp);
  tmp=GET_MAP_OB(m, x, y);   tmp=GET_MAP_OB(m, x, y);
  if (!strcmp(tmp->arch->name, "mountain")){   if (tmp &&(!strcmp(tmp->arch->name, "mountain"))){
  at = find_archetype("mountain1_rivlets");}   at = find_archetype("mountain1_rivlets");}
  else if (!strcmp(tmp->arch->name, "mountain2")){   else if ( tmp && (!strcmp(tmp->arch->name, "mountain2"))){
  at = find_archetype("mountain2_rivlets");}   at = find_archetype("mountain2_rivlets");}
  else if (!strcmp(tmp->arch->name, "mountain4")){   else if (tmp && (!strcmp(tmp->arch->name, "mountain4"))){
  at = find_archetype("mountain2_rivlets");}   at = find_archetype("mountain2_rivlets");}
  else {at = find_archetype("rain5");}   else {at = find_archetype("rain5");}
  if (at != NULL) {   if (at != NULL) {
Line 1647
 
Line 1651
  avoid--;   avoid--;
  }   }
  tmp = GET_MAP_OB(m, x, y);   tmp = GET_MAP_OB(m, x, y);
  if (!strcasecmp(tmp->name, "sea"))   if (tmp && (!strcasecmp(tmp->name, "sea")))
      avoid++;       avoid++;
  else if (!strcasecmp(tmp->name, "sea1"))   else if (tmp && (!strcasecmp(tmp->name, "sea1")))
      avoid++;       avoid++;
  else if (!strcasecmp(tmp->name, "deep_sea"))   else if (tmp && (!strcasecmp(tmp->name, "deep_sea")))
      avoid++;       avoid++;
  else if (!strcasecmp(tmp->name, "shallow_sea"))   else if (tmp && (!strcasecmp(tmp->name, "shallow_sea")))
      avoid++;       avoid++;
  if (avoid > 0) {   if (avoid > 0) {
      at = find_archetype("ice");       at = find_archetype("ice");
Line 1721
 
Line 1725
      oldsnow = avoid_weather(&avoid, m, x, y, &gotsnow, 0);       oldsnow = avoid_weather(&avoid, m, x, y, &gotsnow, 0);
      if (!avoid) {       if (!avoid) {
  tmp=GET_MAP_OB(m, x, y);   tmp=GET_MAP_OB(m, x, y);
  if (!strcmp(tmp->arch->name, "mountain")){   if (tmp && (!strcmp(tmp->arch->name, "mountain"))){
  at = find_archetype("mountain1_rivlets"); break;}   at = find_archetype("mountain1_rivlets"); break;}
  else if (!strcmp(tmp->arch->name, "mountain2")){   else if (tmp && (!strcmp(tmp->arch->name, "mountain2"))){
  at = find_archetype("mountain2_rivlets"); break;}   at = find_archetype("mountain2_rivlets"); break;}
  else if (!strcmp(tmp->arch->name, "mountain4")){   else if (tmp && (!strcmp(tmp->arch->name, "mountain4"))){
  at = find_archetype("mountain2_rivlets"); break;}   at = find_archetype("mountain2_rivlets"); break;}
  if (sky == SKY_LIGHT_RAIN || sky == SKY_RAIN) {    if (sky == SKY_LIGHT_RAIN || sky == SKY_RAIN) {
  switch (rndm(0, SKY_HAIL-sky)) {   switch (rndm(0, SKY_HAIL-sky)) {
Line 1832
 
Line 1836
  }   }
      }       }
      /* Things evaporate fast in the heat */       /* Things evaporate fast in the heat */
      if (temp > 8 && sky < SKY_OVERCAST && rndm(temp, 60) > 50) {       if (GET_MAP_OB(m, x, y) && temp > 8 && sky < SKY_OVERCAST && rndm(temp, 60) > 50) {
  /* evaporate */   /* evaporate */
  for (tmp=GET_MAP_OB(m, x, y)->above; tmp; tmp = tmp->above) {   for (tmp=GET_MAP_OB(m, x, y)->above; tmp; tmp = tmp->above) {
      avoid = 0;       avoid = 0;
Line 1965
 
Line 1969
      if (temp < weather_grow[i].tempmin ||       if (temp < weather_grow[i].tempmin ||
  temp > weather_grow[i].tempmax)   temp > weather_grow[i].tempmax)
  continue;   continue;
      if (GET_MAP_OB(m, x, y)->elevation < weather_grow[i].elevmin ||       if ((!GET_MAP_OB(m, x, y)) ||
        GET_MAP_OB(m, x, y)->elevation < weather_grow[i].elevmin ||
  GET_MAP_OB(m, x, y)->elevation > weather_grow[i].elevmax)   GET_MAP_OB(m, x, y)->elevation > weather_grow[i].elevmax)
  continue;   continue;
      /* we got this far.. must be a match */       /* we got this far.. must be a match */
Line 2039
 
Line 2044
  for (i=0; weather_tile[i].herb != NULL; i++) {   for (i=0; weather_tile[i].herb != NULL; i++) {
      found=0;       found=0;
      doublestack=NULL;       doublestack=NULL;
        if (GET_MAP_OB(m, x, y))
      for (tmp=GET_MAP_OB(m, x, y)->above; tmp; tmp = tmp->above) {       for (tmp=GET_MAP_OB(m, x, y)->above; tmp; tmp = tmp->above) {
  if (weather_tile[i].tile != NULL)   if (weather_tile[i].tile != NULL)
      if (strcmp(tmp->arch->name,       if (strcmp(tmp->arch->name,
Line 2080
 
Line 2086
      if (temp < weather_tile[i].tempmin ||       if (temp < weather_tile[i].tempmin ||
  temp > weather_tile[i].tempmax)   temp > weather_tile[i].tempmax)
  continue;   continue;
      if (GET_MAP_OB(m, x, y)->elevation < weather_tile[i].elevmin ||       if ( (!GET_MAP_OB(m, x, y)) ||
            GET_MAP_OB(m, x, y)->elevation < weather_tile[i].elevmin ||
  GET_MAP_OB(m, x, y)->elevation > weather_tile[i].elevmax)   GET_MAP_OB(m, x, y)->elevation > weather_tile[i].elevmax)
  continue;   continue;
      /* we got this far.. must be a match */       /* we got this far.. must be a match */
      if (strcmp(GET_MAP_OB(m, x, y)->arch->name,       if (GET_MAP_OB(m, x, y) && strcmp(GET_MAP_OB(m, x, y)->arch->name,
         weather_tile[i].herb) == 0)          weather_tile[i].herb) == 0)
  break; /* no sense in doubling up */   break; /* no sense in doubling up */
      at = find_archetype(weather_tile[i].herb);       at = find_archetype(weather_tile[i].herb);
      break;       break;
  }   }
  if (at != NULL) {   if (at != NULL) {
      if (weather_tile[i].tile != NULL &&       if (weather_tile[i].tile != NULL && GET_MAP_OB(m, x, y) &&
  strcmp(weather_tile[i].tile,   strcmp(weather_tile[i].tile,
         GET_MAP_OB(m, x, y)->arch->name) != 0)          GET_MAP_OB(m, x, y)->arch->name) != 0)
  dat = find_archetype(weather_tile[i].tile);   dat = find_archetype(weather_tile[i].tile);


Legend:
line(s) removed in v.1.35 
line(s) changed
 line(s) added in v.1.36

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