version 1.12 | | version 1.13 |
---|
| | |
/* | | /* |
* static char *rcsid_treasure_c = | | * static char *rcsid_treasure_c = |
* "$Id: treasure.c,v 1.12 2001/04/10 18:23:15 mardahl Exp $"; | | * "$Id: treasure.c,v 1.13 2001/04/23 08:01:19 mardahl Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
object **doorlist; | | object **doorlist; |
object *chest; | | object *chest; |
if(tdiv==3) tdiv = 2; /* this symmetry uses a divisor of 2*/ | | if(tdiv==3) tdiv = 2; /* this symmetry uses a divisor of 2*/ |
| | /* don't put a chest on an exit. */ |
chest=place_chest(treasureoptions,i,j,map,style_map,num_treasures/tdiv,RP); | | chest=place_chest(treasureoptions,i,j,map,style_map,num_treasures/tdiv,RP); |
| | if(!chest) continue; /* if no chest was placed NEXT */ |
if(treasureoptions & (DOORED|HIDDEN)) { | | if(treasureoptions & (DOORED|HIDDEN)) { |
doorlist=find_doors_in_room(map,i,j,RP); | | doorlist=find_doors_in_room(map,i,j,RP); |
lock_and_hide_doors(doorlist,map,treasureoptions,RP); | | lock_and_hide_doors(doorlist,map,treasureoptions,RP); |
| | |
tries++; | | tries++; |
} | | } |
chest=place_chest(treasureoptions,i,j,map,style_map,num_treasures,RP); | | chest=place_chest(treasureoptions,i,j,map,style_map,num_treasures,RP); |
| | if(!chest) return; |
i = chest->x; j = chest->y; | | i = chest->x; j = chest->y; |
if(treasureoptions &( DOORED|HIDDEN)) { | | if(treasureoptions &( DOORED|HIDDEN)) { |
doorlist=surround_by_doors(map,i,j,treasureoptions); | | doorlist=surround_by_doors(map,i,j,treasureoptions); |
| | |
| | |
object * place_chest(int treasureoptions,int x, int y,mapstruct *map, mapstruct *style_map,int n_treasures,RMParms *RP) { | | object * place_chest(int treasureoptions,int x, int y,mapstruct *map, mapstruct *style_map,int n_treasures,RMParms *RP) { |
object *the_chest; | | object *the_chest; |
int i; | | int i,xl,yl; |
| | |
| | /* first, find a place to put the chest. */ |
| | i = find_first_free_spot(find_archetype("chest"),map,x,y); |
| | xl = x + freearr_x[i]; yl = y + freearr_y[i]; |
| | |
| | /* if the placement is blocked, return a fail. */ |
| | if(wall_blocked(map,xl,yl)) return 0; |
| | |
| | |
/* use the nicer container-chests for multiple treasures... Allows locking. */ | | /* use the nicer container-chests for multiple treasures... Allows locking. */ |
if(n_treasures > 1) | | if(n_treasures > 1) |
the_chest = get_archetype("chest_2"); | | the_chest = get_archetype("chest"); /* was "chest_2" */ |
else | | else |
the_chest = get_archetype("chest"); | | the_chest = get_archetype("chest"); |
| | |
| | |
} | | } |
| | |
/* actually place the chest. */ | | /* actually place the chest. */ |
i = find_first_free_spot(the_chest->arch,map,x,y); | | the_chest->x = xl; the_chest->y = yl; |
the_chest->x = x+freearr_x[i]; the_chest->y = y+freearr_y[i]; | | |
insert_ob_in_map(the_chest,map,NULL); | | insert_ob_in_map(the_chest,map,NULL); |
return the_chest; | | return the_chest; |
} | | } |