Difference for random_maps/special.c from version 1.12 to 1.13


version 1.12 version 1.13
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_special_c =   * static char *rcsid_special_c =
  *   "$Id: special.c,v 1.12 2001/06/04 06:41:02 mwedel Exp $";   *   "$Id: special.c,v 1.13 2001/07/14 04:08:06 mwedel Exp $";
  */   */
   
 /*  /*
Line 75
 
Line 75
   object *new_ob;    object *new_ob;
      
   /* First, splatter everything in the dest map at the location */    /* First, splatter everything in the dest map at the location */
   nuke_map_region(dest_map,x,y,in_map->map_object->x,in_map->map_object->y);    nuke_map_region(dest_map,x,y,MAP_WIDTH(in_map),MAP_HEIGHT(in_map));
    
   for(i=0;i<in_map->map_object->x;i++)     for(i=0;i<MAP_WIDTH(in_map);i++)
     for(j=0;j<in_map->map_object->y;j++) {      for(j=0;j<MAP_HEIGHT(in_map);j++) {
       for(tmp=get_map_ob(in_map,i,j);tmp!=NULL;tmp=tmp->above) {        for(tmp=get_map_ob(in_map,i,j);tmp!=NULL;tmp=tmp->above) {
         /* don't copy things with multiple squares:  must be dealt with          /* don't copy things with multiple squares:  must be dealt with
            specially. */             specially. */
Line 101
 
Line 101
   int l,m;    int l,m;
   /* don't even try to place a submap into a map if the big map isn't    /* don't even try to place a submap into a map if the big map isn't
      sufficiently large. */       sufficiently large. */
   if(2*xsize > map->map_object->x || 2*ysize > map->map_object->y) return 0;    if(2*xsize > MAP_WIDTH(map) || 2*ysize > MAP_HEIGHT(map)) return 0;
      
   /* search a bit for a completely free spot. */    /* search a bit for a completely free spot. */
   for(tries=0;tries<20;tries++) {    for(tries=0;tries<20;tries++) {
     /* pick a random location in the layout */      /* pick a random location in the layout */
     i = RANDOM() % (map->map_object->x - xsize-2)+1;      i = RANDOM() % (MAP_WIDTH(map) - xsize-2)+1;
     j = RANDOM() % (map->map_object->y - ysize-2)+1;      j = RANDOM() % (MAP_HEIGHT(map) - ysize-2)+1;
     is_occupied=0;      is_occupied=0;
     for(l=i;l<i + xsize;l++)      for(l=i;l<i + xsize;l++)
       for(m=j;m<j + ysize;m++)        for(m=j;m<j + ysize;m++)
Line 121
 
Line 121
   if(is_occupied) { /* failure, try a relaxed placer. */    if(is_occupied) { /* failure, try a relaxed placer. */
     /* pick a random location in the layout */      /* pick a random location in the layout */
     for(tries=0;tries<10;tries++) {      for(tries=0;tries<10;tries++) {
       i = RANDOM() % (map->map_object->x - xsize-2)+1;        i = RANDOM() % (MAP_WIDTH(map) - xsize-2)+1;
       j = RANDOM() % (map->map_object->y - ysize-2)+1;        j = RANDOM() % (MAP_HEIGHT(map) - ysize-2)+1;
       is_occupied=0;        is_occupied=0;
       for(l=i;l<i + xsize;l++)        for(l=i;l<i + xsize;l++)
         for(m=j;m<j + ysize;m++)          for(m=j;m<j + ysize;m++)
Line 144
 
Line 144
   object *potion=get_object();    object *potion=get_object();
   copy_object(pick_random_object(fountain_style),potion);    copy_object(pick_random_object(fountain_style),potion);
   while(i<0 && tries<10) {    while(i<0 && tries<10) {
     ix = RANDOM() % (map->map_object->x -2) +1;      ix = RANDOM() % (MAP_WIDTH(map) -2) +1;
     iy = RANDOM() % (map->map_object->x -2) +1;      iy = RANDOM() % (MAP_WIDTH(map) -2) +1; /* is this really supposed to be the width? */
     i = find_first_free_spot(fountain->arch,map,ix,iy);      i = find_first_free_spot(fountain->arch,map,ix,iy);
     tries++;      tries++;
   };    };
Line 165
 
Line 165
   potion->material=M_ADAMANT;    potion->material=M_ADAMANT;
   fountain->x = ix;    fountain->x = ix;
   fountain->y = iy;    fountain->y = iy;
   insert_ob_in_map(fountain,map,NULL);    insert_ob_in_map(fountain,map,NULL,0);
   insert_ob_in_map(potion,map,NULL);    insert_ob_in_map(potion,map,NULL,0);
   
 }  }
   
Line 181
 
Line 181
   copy_object(pick_random_object(exit_style),the_exit);    copy_object(pick_random_object(exit_style),the_exit);
   
   while(i<0) {    while(i<0) {
     ix = RANDOM() % (map->map_object->x -2) +1;      ix = RANDOM() % (MAP_WIDTH(map) -2) +1;
     iy = RANDOM() % (map->map_object->x -2) +1;      iy = RANDOM() % (MAP_WIDTH(map) -2) +1; /* Is this supposed to be width? */
     i = find_first_free_spot(the_exit->arch,map,ix,iy);      i = find_first_free_spot(the_exit->arch,map,ix,iy);
   };    };
      
Line 236
 
Line 236
   
    
   }    }
   insert_ob_in_map(the_exit,map,NULL);    insert_ob_in_map(the_exit,map,NULL,0);
 }  }
      
        
Line 254
 
Line 254
     special_map = find_style("/styles/specialmaps",0,RP->difficulty);       special_map = find_style("/styles/specialmaps",0,RP->difficulty);
     if(special_map==NULL) return;      if(special_map==NULL) return;
    
     if(find_spot_for_submap(map,layout,&ix,&iy,special_map->map_object->x,special_map->map_object->y))       if(find_spot_for_submap(map,layout,&ix,&iy,MAP_WIDTH(special_map),MAP_HEIGHT(special_map)))
       include_map_in_map(map,special_map,ix,iy);        include_map_in_map(map,special_map,ix,iy);
     break;      break;
   }    }


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

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