version 1.59 | | version 1.60 |
---|
| | |
/* | | /* |
* static char *rcsid_object_c = | | * static char *rcsid_object_c = |
* "$Id: object.c,v 1.59 2002/11/13 00:49:46 garbled Exp $"; | | * "$Id: object.c,v 1.60 2002/12/01 03:46:25 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
if (!QUERY_FLAG(op, FLAG_ALIVE)) | | if (!QUERY_FLAG(op, FLAG_ALIVE)) |
CLEAR_FLAG(op, FLAG_NO_STEAL); | | CLEAR_FLAG(op, FLAG_NO_STEAL); |
| | |
| | if (flag & INS_BELOW_ORIGINATOR) { |
| | if (originator->map != op->map || originator->x != op->x || |
| | originator->y != op->y) { |
| | LOG(llevError,"insert_ob_in_map called with INS_BELOW_ORIGINATOR when originator not on same space!\n"); |
| | abort(); |
| | } |
| | op->above = originator; |
| | op->below = originator->below; |
| | if (op->below) op->below->above = op; |
| | else SET_MAP_OB(op->map, op->x, op->y, op); |
| | originator->below = op; |
| | } else { |
/* If there are other objects, then */ | | /* If there are other objects, then */ |
if((top=GET_MAP_OB(op->map,op->x,op->y))!=NULL) { | | if((top=GET_MAP_OB(op->map,op->x,op->y))!=NULL) { |
object *last=NULL; | | object *last=NULL; |
| | |
* If there are multiple objects on this space, we do some trickier handling. | | * If there are multiple objects on this space, we do some trickier handling. |
* We've already dealt with merging if appropriate. | | * We've already dealt with merging if appropriate. |
* Generally, we want to put the new object on top. But if | | * Generally, we want to put the new object on top. But if |
* flag contains INS_ABOVE_FLOOR_ONLY, once we find the lastt | | * flag contains INS_ABOVE_FLOOR_ONLY, once we find the last |
* floor, we want to insert above that and no further. | | * floor, we want to insert above that and no further. |
* Also, if there are spell objects on this space, we stop processing | | * Also, if there are spell objects on this space, we stop processing |
* once we get to them. This reduces the need to traverse over all of | | * once we get to them. This reduces the need to traverse over all of |
| | |
*/ | | */ |
| | |
/* Have object 'fall below' other objects that block view. | | /* Have object 'fall below' other objects that block view. |
* We take simple approach - instead of dumping it below the object that | | |
* blocks the view, we just dump it right above the floor. Saves | | |
* us the effort of trying to find the object that blocks the view. | | |
* If INS_ON_TOP is used, don't do this processing | | * If INS_ON_TOP is used, don't do this processing |
| | * Need to find the object that in fact blocks view, otherwise |
| | * stacking is a bit odd. |
*/ | | */ |
if (!(flag & INS_ON_TOP) && blocks_view(op->map, op->x, op->y) && | | if (!(flag & INS_ON_TOP) && blocks_view(op->map, op->x, op->y) && |
(op->face && !op->face->visibility)) { | | (op->face && !op->face->visibility)) { |
top = floor; | | for (last=top; last != floor; last=last->below) |
| | if QUERY_FLAG(last, FLAG_BLOCKSVIEW) break; |
| | /* Check to see i we found the object that blocks view, |
| | * and make sure we have a below pointer for it so that |
| | * we can get inserted below this one, which requires we |
| | * set top to the object below us. |
| | */ |
| | if (last && last->below && last != floor) top=last->below; |
} | | } |
} /* If objects on this space */ | | } /* If objects on this space */ |
| | |
| | |
op->below = top; | | op->below = top; |
top->above = op; | | top->above = op; |
} | | } |
| | } /* else not INS_BELOW_ORIGINATOR */ |
| | |
if(op->type==PLAYER) | | if(op->type==PLAYER) |
op->contr->do_los=1; | | op->contr->do_los=1; |
| | |
/* If we have a floor, we know the player, if any, will be above | | /* If we have a floor, we know the player, if any, will be above |
* it, so save a few ticks and start from there. | | * it, so save a few ticks and start from there. |
*/ | | */ |