version 1.84 | | version 1.85 |
---|
| | |
/* | | /* |
* static char *rcsid_apply_c = | | * static char *rcsid_apply_c = |
* "$Id: apply.c,v 1.84 2003/06/26 11:27:43 gros Exp $"; | | * "$Id: apply.c,v 1.85 2003/09/03 12:25:06 tchize Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
| | |
switch(op->type) { | | switch(op->type) { |
case SHOP_FLOOR: | | case SHOP_FLOOR: |
if (op->randomitems==NULL) return 0; | | if (!HAS_RANDOM_ITEMS(op)) return 0; |
do { | | do { |
i=10; /* let's give it 10 tries */ | | i=10; /* let's give it 10 tries */ |
while((tmp=generate_treasure(op->randomitems, | | while((tmp=generate_treasure(op->randomitems, |
| | |
break; | | break; |
| | |
case TREASURE: | | case TREASURE: |
| | if (QUERY_FLAG(op,FLAG_IS_A_TEMPLATE)) |
| | return 0; |
while ((op->stats.hp--)>0) | | while ((op->stats.hp--)>0) |
create_treasure(op->randomitems, op, op->map?GT_ENVIRONMENT:0, | | create_treasure(op->randomitems, op, op->map?GT_ENVIRONMENT:0, |
op->stats.exp ? op->stats.exp : | | op->stats.exp ? op->stats.exp : |
| | |
invnext = invtmp->below; | | invnext = invtmp->below; |
if(QUERY_FLAG(invtmp,FLAG_AUTO_APPLY)) | | if(QUERY_FLAG(invtmp,FLAG_AUTO_APPLY)) |
auto_apply(invtmp); | | auto_apply(invtmp); |
else if(invtmp->type==TREASURE) { | | else if(invtmp->type==TREASURE && HAS_RANDOM_ITEMS(invtmp)) { |
while ((invtmp->stats.hp--)>0) | | while ((invtmp->stats.hp--)>0) |
create_treasure(invtmp->randomitems, invtmp, 0, | | create_treasure(invtmp->randomitems, invtmp, 0, |
m->difficulty,0); | | m->difficulty,0); |
| | |
| | |
if(QUERY_FLAG(tmp,FLAG_AUTO_APPLY)) | | if(QUERY_FLAG(tmp,FLAG_AUTO_APPLY)) |
auto_apply(tmp); | | auto_apply(tmp); |
else if((tmp->type==TREASURE || (tmp->type==CONTAINER))&&tmp->randomitems) { | | else if((tmp->type==TREASURE || (tmp->type==CONTAINER))&&HAS_RANDOM_ITEMS(tmp)) { |
while ((tmp->stats.hp--)>0) | | while ((tmp->stats.hp--)>0) |
create_treasure(tmp->randomitems, tmp, 0, | | create_treasure(tmp->randomitems, tmp, 0, |
m->difficulty,0); | | m->difficulty,0); |
| | |
tmp->speed = 0; | | tmp->speed = 0; |
update_ob_speed(tmp); | | update_ob_speed(tmp); |
} | | } |
else if(tmp && tmp->arch && tmp->type!=PLAYER && tmp->type!=TREASURE && | | else if(tmp && tmp->arch && tmp->type!=PLAYER && tmp->type!=TREASURE && HAS_RANDOM_ITEMS(tmp)) |
tmp->randomitems) | | |
create_treasure(tmp->randomitems, tmp, GT_APPLY, | | create_treasure(tmp->randomitems, tmp, GT_APPLY, |
m->difficulty,0); | | m->difficulty,0); |
} | | } |
| | /*end of cycle through map square*/ |
for(x=0;x<MAP_WIDTH(m);x++) | | for(x=0;x<MAP_WIDTH(m);x++) |
for(y=0;y<MAP_HEIGHT(m);y++) | | for(y=0;y<MAP_HEIGHT(m);y++) |
for(tmp=get_map_ob(m,x,y);tmp!=NULL;tmp=tmp->above) | | for(tmp=get_map_ob(m,x,y);tmp!=NULL;tmp=tmp->above) |