version 1.100 | | version 1.101 |
---|
| | |
/* | | /* |
* static char *rcsid_object_c = | | * static char *rcsid_object_c = |
* "$Id: object.c,v 1.100 2005/08/29 03:52:49 mwedel Exp $"; | | * "$Id: object.c,v 1.101 2005/08/31 20:07:22 tchize Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
/* link the object above us */ | | /* link the object above us */ |
if (op->above) | | if (op->above) |
op->above->below=op->below; | | op->above->below=op->below; |
| | else |
| | SET_MAP_TOP(m,x,y,op->below); /* we were top, set new top */ |
| | |
/* Relink the object below us, if there is one */ | | /* Relink the object below us, if there is one */ |
if(op->below) { | | if(op->below) { |
| | |
op->below = originator->below; | | op->below = originator->below; |
if (op->below) op->below->above = op; | | if (op->below) op->below->above = op; |
else SET_MAP_OB(op->map, op->x, op->y, op); | | else SET_MAP_OB(op->map, op->x, op->y, op); |
| | /* since *below* originator, no need to update top */ |
originator->below = op; | | originator->below = op; |
} else { | | } 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((! (flag & INS_MAP_LOAD)) && ((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. |
| | |
if (last && last->below && last != floor) top=last->below; | | if (last && last->below && last != floor) top=last->below; |
} | | } |
} /* If objects on this space */ | | } /* If objects on this space */ |
| | if (flag & INS_MAP_LOAD) |
| | top = GET_MAP_TOP(op->map,op->x,op->y); |
if (flag & INS_ABOVE_FLOOR_ONLY) top = floor; | | if (flag & INS_ABOVE_FLOOR_ONLY) top = floor; |
| | |
/* Top is the object that our object (op) is going to get inserted above. | | /* Top is the object that our object (op) is going to get inserted above. |
| | |
op->below = top; | | op->below = top; |
top->above = op; | | top->above = op; |
} | | } |
| | if (op->above==NULL) |
| | SET_MAP_TOP(op->map,op->x, op->y, op); |
} /* else not INS_BELOW_ORIGINATOR */ | | } /* else not INS_BELOW_ORIGINATOR */ |
| | |
if(op->type==PLAYER) | | if(op->type==PLAYER) |
| | |
/* 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. |
*/ | | */ |
| | if (!(flag |INS_MAP_LOAD)) |
for(tmp=floor?floor:GET_MAP_OB(op->map,op->x,op->y);tmp!=NULL;tmp=tmp->above) { | | for(tmp=floor?floor:GET_MAP_OB(op->map,op->x,op->y);tmp!=NULL;tmp=tmp->above) { |
if (tmp->type == PLAYER) | | if (tmp->type == PLAYER) |
tmp->contr->socket.update_look=1; | | tmp->contr->socket.update_look=1; |