Difference for server/weather.c from version 1.11 to 1.12


version 1.11 version 1.12
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_weather_c =   * static char *rcsid_weather_c =
  *   "$Id: weather.c,v 1.11 2002/10/31 04:50:12 garbled Exp $";   *   "$Id: weather.c,v 1.12 2002/11/06 09:47:23 garbled Exp $";
  */   */
 /*  /*
     CrossFire, A Multiplayer game for X-windows      CrossFire, A Multiplayer game for X-windows
Line 1152
 
Line 1152
 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;      int x, y;
     int avoid, two, temp, sky;      int avoid, two, temp, sky, gotsnow;
     object *ob, *tmp;      object *ob, *tmp, *oldsnow;
     archetype *at;      archetype *at;
   
     for (x=0; x < settings.worldmaptilesizex; x++) {      for (x=0; x < settings.worldmaptilesizex; x++) {
Line 1164
 
Line 1164
      /* this will definately need tuning */       /* this will definately need tuning */
      avoid = 0;       avoid = 0;
      two = 0;       two = 0;
        gotsnow = 0;
      temp = real_world_temperature(x, y, m);       temp = real_world_temperature(x, y, m);
      sky = weathermap[wx][wy].sky;       sky = weathermap[wx][wy].sky;
      if (temp <= 0 && sky > SKY_OVERCAST && sky < SKY_FOG)       if (temp <= 0 && sky > SKY_OVERCAST && sky < SKY_FOG)
  sky += 10; /*let it snow*/   sky += 10; /*let it snow*/
      for (tmp=GET_MAP_OB(m, x, y); tmp; tmp = tmp->above) {       for (tmp=GET_MAP_OB(m, x, y); tmp; tmp = tmp->above) {
  if (!strcasecmp(tmp->name, "snow"))   /* problem: snow never gets upgraded */
    if (!strcmp(tmp->arch->name, "snow")) {
        gotsnow++;
        oldsnow = tmp;
    } else if (!strcmp(tmp->arch->name, "snow2")) {
        gotsnow++;
        oldsnow = tmp;
    } else if (!strcmp(tmp->arch->name, "snow4")) {
        gotsnow++;
        oldsnow = tmp;
    } else if (!strcmp(tmp->name, "drifts"))
      avoid++;       avoid++;
  else if (!strcmp(tmp->name, "snow2"))   else if (!strcmp(tmp->arch->name, "cforest1"))
      avoid++;  
  else if (!strcmp(tmp->name, "drifts"))  
      avoid++;  
  else if (!strcmp(tmp->name, "cforest1"))  
      avoid++;       avoid++;
  else if (!strcmp(tmp->name, "sea"))   else if (!strcmp(tmp->name, "sea"))
      avoid++;       avoid++;
Line 1194
 
Line 1201
  if (!strcmp(GET_MAP_OB(m, x, y)->name, "hills") &&   if (!strcmp(GET_MAP_OB(m, x, y)->name, "hills") &&
      sky >= SKY_LIGHT_SNOW)       sky >= SKY_LIGHT_SNOW)
      at = find_archetype("drifts");       at = find_archetype("drifts");
    if (!strcmp(GET_MAP_OB(m, x, y)->name, "cobblestones") &&
        sky >= SKY_LIGHT_SNOW)
        at = find_archetype("snow4");
    if (!strcmp(GET_MAP_OB(m, x, y)->arch->name, "cobblestones2") &&
        sky >= SKY_LIGHT_SNOW)
        at = find_archetype("snow4");
    if (!strcmp(GET_MAP_OB(m, x, y)->name, "stones") &&
        sky >= SKY_LIGHT_SNOW)
        at = find_archetype("snow4");
    if (!strcmp(GET_MAP_OB(m, x, y)->name, "flagstone") &&
        sky >= SKY_LIGHT_SNOW)
        at = find_archetype("snow4");
    if (!strcmp(GET_MAP_OB(m, x, y)->arch->name, "stonefloor2") &&
        sky >= SKY_LIGHT_SNOW)
        at = find_archetype("snow4");
  if (!strcmp(GET_MAP_OB(m, x, y)->name, "evergreens") &&   if (!strcmp(GET_MAP_OB(m, x, y)->name, "evergreens") &&
      sky >= SKY_LIGHT_SNOW)       sky >= SKY_LIGHT_SNOW)
      at = find_archetype("cforest1");       at = find_archetype("cforest1");
Line 1204
 
Line 1226
      two++;       two++;
  if (!strcmp(GET_MAP_OB(m, x, y)->name, "tree"))   if (!strcmp(GET_MAP_OB(m, x, y)->name, "tree"))
      two++;         two++; 
    if (gotsnow && at) {
        if (!strcmp(oldsnow->arch->name, at->name))
    at = NULL;
        else {
    remove_ob(oldsnow);
    free_object(oldsnow);
    tmp=GET_MAP_OB(m, x, y);
    /* clean up the trees we put over the snow */
    if (!strcmp(tmp->name, "evergreen"))
    tmp = tmp->above;
    else if (!strcmp(tmp->name, "tree"))
        tmp = tmp->above;
    if (tmp != NULL)
        if (strcmp(tmp->arch->name, "tree3") == 0 ||
    strcmp(tmp->arch->name, "tree5") == 0) {
    remove_ob(tmp);
    free_object(tmp);
        }
        }
    }
  if (at != NULL) {   if (at != NULL) {
      ob = get_object();       ob = get_object();
      copy_object(&at->clone, ob);       copy_object(&at->clone, ob);
      ob->x = x;       ob->x = x;
      ob->y = y;       ob->y = y;
        if (!strcmp(ob->arch->name, "snow4"))
    SET_FLAG(ob, FLAG_OVERLAY_FLOOR);
      insert_ob_in_map(ob, m, ob,       insert_ob_in_map(ob, m, ob,
          INS_NO_MERGE | INS_NO_WALK_ON | INS_ABOVE_FLOOR_ONLY);           INS_NO_MERGE | INS_NO_WALK_ON | INS_ABOVE_FLOOR_ONLY);
      if (two) {       if (two) {
Line 1231
 
Line 1275
      avoid = 0;       avoid = 0;
      if (!strcmp(tmp->name, "snow"))       if (!strcmp(tmp->name, "snow"))
  avoid++;   avoid++;
      else if (!strcmp(tmp->name, "snow2"))       else if (!strcmp(tmp->arch->name, "snow2"))
    avoid++;
        else if (!strcmp(tmp->arch->name, "drifts"))
    avoid++;
        else if (!strcmp(tmp->arch->name, "cforest1"))
  avoid++;   avoid++;
      else if (!strcmp(tmp->name, "drifts"))       else if (!strcmp(tmp->arch->name, "snow4"))
  avoid++;   avoid++;
      else if (!strcmp(tmp->name, "cforest1"))       else if (!strcmp(tmp->arch->name, "glacier"))
  avoid++;   avoid++;
      if (avoid) {       if (avoid) {
  remove_ob(tmp);   remove_ob(tmp);
Line 1247
 
Line 1295
  else if (!strcmp(tmp->name, "tree"))   else if (!strcmp(tmp->name, "tree"))
      tmp = tmp->above;       tmp = tmp->above;
  if (tmp != NULL)   if (tmp != NULL)
      if (strcmp(tmp->name, "tree3") == 0 ||       if (strcmp(tmp->arch->name, "tree3") == 0 ||
          strcmp(tmp->name, "tree5") == 0) {           strcmp(tmp->arch->name, "tree5") == 0) {
  remove_ob(tmp);   remove_ob(tmp);
  free_object(tmp);   free_object(tmp);
      }       }


Legend:
line(s) removed in v.1.11 
line(s) changed
 line(s) added in v.1.12

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