version 1.92 | | version 1.93 |
---|
| | |
/* | | /* |
* static char *rcsid_time_c = | | * static char *rcsid_time_c = |
* "$Id: time.c,v 1.92 2006/08/19 20:22:21 ryo_saeba Exp $"; | | * "$Id: time.c,v 1.93 2006/08/26 03:30:15 qal21 Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
*/ | | */ |
static void generate_monster_inv(object *gen) { | | static void generate_monster_inv(object *gen) { |
int i; | | int i; |
| | int nx, ny; |
object *op,*head=NULL; | | object *op,*head=NULL; |
| | |
int qty=0; | | int qty=0; |
| | |
qty=rndm(0,qty-1); | | qty=rndm(0,qty-1); |
for (op=gen->inv;qty;qty--) | | for (op=gen->inv;qty;qty--) |
op=op->below; | | op=op->below; |
i=find_free_spot(op,gen->map,gen->x,gen->y,1,9); | | i=find_multi_free_spot_around(op, gen, &nx, &ny); |
if (i==-1) | | if (i==-1) |
return; | | return; |
head=object_create_clone(op); | | head=object_create_clone(op); |
| | |
unflag_inv (head,FLAG_IS_A_TEMPLATE); | | unflag_inv (head,FLAG_IS_A_TEMPLATE); |
if (rndm(0, 9)) | | if (rndm(0, 9)) |
generate_artifact(head, gen->map->difficulty); | | generate_artifact(head, gen->map->difficulty); |
insert_ob_in_map_at(head,gen->map,gen,0,gen->x+freearr_x[i],gen->y+freearr_y[i]); | | insert_ob_in_map_at(head,gen->map,gen,0,nx,ny); |
if (QUERY_FLAG(head, FLAG_FREED)) return; | | if (QUERY_FLAG(head, FLAG_FREED)) return; |
fix_multipart_object(head); | | fix_multipart_object(head); |
if(HAS_RANDOM_ITEMS(head)) | | if(HAS_RANDOM_ITEMS(head)) |
| | |
| | |
static void generate_monster_arch(object *gen) { | | static void generate_monster_arch(object *gen) { |
int i; | | int i; |
| | int nx, ny; |
object *op,*head=NULL,*prev=NULL; | | object *op,*head=NULL,*prev=NULL; |
archetype *at=gen->other_arch; | | archetype *at=gen->other_arch; |
| | |
| | |
LOG(llevError,"Generator (%s) not on a map?\n", gen->name); | | LOG(llevError,"Generator (%s) not on a map?\n", gen->name); |
return; | | return; |
} | | } |
i=find_free_spot(&at->clone,gen->map,gen->x,gen->y,1,9); | | i=find_multi_free_spot_around(&at->clone, gen, &nx, &ny); |
if (i==-1) return; | | if (i==-1) return; |
while(at!=NULL) { | | while(at!=NULL) { |
op=arch_to_object(at); | | op=arch_to_object(at); |
op->x=gen->x+freearr_x[i]+at->clone.x; | | op->x=nx+at->clone.x; |
op->y=gen->y+freearr_y[i]+at->clone.y; | | op->y=ny+at->clone.y; |
| | |
if(head!=NULL) | | if(head!=NULL) |
op->head=head,prev->more=op; | | op->head=head,prev->more=op; |