version 1.70 | | version 1.71 |
---|
| | |
/* | | /* |
* static char *rcsid_object_c = | | * static char *rcsid_object_c = |
* "$Id: object.c,v 1.70 2003/07/13 07:21:11 garbled Exp $"; | | * "$Id: object.c,v 1.71 2003/09/03 12:25:06 tchize Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
tmp=op->below; | | tmp=op->below; |
remove_ob(op); | | remove_ob(op); |
if(QUERY_FLAG(op,FLAG_STARTEQUIP)||QUERY_FLAG(op,FLAG_NO_DROP) || | | if(QUERY_FLAG(op,FLAG_STARTEQUIP)||QUERY_FLAG(op,FLAG_NO_DROP) || |
op->type==RUNE) | | op->type==RUNE || QUERY_FLAG(op,FLAG_IS_A_TEMPLATE)) |
free_object(op); | | free_object(op); |
else { | | else { |
op->x=ob->x; | | op->x=ob->x; |
| | |
return NULL; | | return NULL; |
} | | } |
| | |
| | /* |
| | * same as insert_ob_in_map except it handle separate coordinates and do a clean |
| | * job preparing multi-part monsters |
| | */ |
| | object *insert_ob_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y){ |
| | object* tmp; |
| | if (op->head) |
| | op=op->head; |
| | for (tmp=op;tmp;tmp=tmp->more){ |
| | tmp->x=x+tmp->arch->clone.x; |
| | tmp->y=y+tmp->arch->clone.y; |
| | } |
| | return insert_ob_in_map (op, m, originator, flag); |
| | } |
| | |
/* | | /* |
* insert_ob_in_map (op, map, originator, flag): | | * insert_ob_in_map (op, map, originator, flag): |
| | |
} | | } |
| | |
/* | | /* |
| | * activate recursively a flag on an object inventory |
| | */ |
| | void flag_inv(object*op, int flag){ |
| | object *tmp; |
| | if(op->inv) |
| | for(tmp = op->inv; tmp != NULL; tmp = tmp->below){ |
| | SET_FLAG(tmp, flag); |
| | flag_inv(tmp,flag); |
| | } |
| | }/* |
| | * desactivate recursively a flag on an object inventory |
| | */ |
| | void unflag_inv(object*op, int flag){ |
| | object *tmp; |
| | if(op->inv) |
| | for(tmp = op->inv; tmp != NULL; tmp = tmp->below){ |
| | CLEAR_FLAG(tmp, flag); |
| | unflag_inv(tmp,flag); |
| | } |
| | } |
| | |
| | /* |
* set_cheat(object) sets the cheat flag (WAS_WIZ) in the object and in | | * set_cheat(object) sets the cheat flag (WAS_WIZ) in the object and in |
* all it's inventory (recursively). | | * all it's inventory (recursively). |
* If checksums are used, a player will get set_cheat called for | | * If checksums are used, a player will get set_cheat called for |
| | |
*/ | | */ |
| | |
void set_cheat(object *op) { | | void set_cheat(object *op) { |
object *tmp; | | |
SET_FLAG(op, FLAG_WAS_WIZ); | | SET_FLAG(op, FLAG_WAS_WIZ); |
if(op->inv) | | flag_inv(op, FLAG_WAS_WIZ); |
for(tmp = op->inv; tmp != NULL; tmp = tmp->below) | | |
set_cheat(tmp); | | |
} | | } |
| | |
/* | | /* |