… | |
… | |
149 | create_treasure (op->randomitems, op, GT_APPLY, gen->map->difficulty); |
149 | create_treasure (op->randomitems, op, GT_APPLY, gen->map->difficulty); |
150 | |
150 | |
151 | return; |
151 | return; |
152 | } |
152 | } |
153 | |
153 | |
154 | op->destroy (true); |
154 | op->destroy (); |
155 | } |
155 | } |
156 | |
156 | |
157 | void |
157 | void |
158 | remove_force (object *op) |
158 | remove_force (object *op) |
159 | { |
159 | { |
… | |
… | |
171 | CLEAR_FLAG (op, FLAG_APPLIED); |
171 | CLEAR_FLAG (op, FLAG_APPLIED); |
172 | change_abil (op->env, op); |
172 | change_abil (op->env, op); |
173 | op->env->update_stats (); |
173 | op->env->update_stats (); |
174 | } |
174 | } |
175 | |
175 | |
176 | op->destroy (true); |
176 | op->destroy (); |
177 | } |
177 | } |
178 | |
178 | |
179 | void |
179 | void |
180 | remove_blindness (object *op) |
180 | remove_blindness (object *op) |
181 | { |
181 | { |
… | |
… | |
188 | { |
188 | { |
189 | change_abil (op->env, op); |
189 | change_abil (op->env, op); |
190 | op->env->update_stats (); |
190 | op->env->update_stats (); |
191 | } |
191 | } |
192 | |
192 | |
193 | op->destroy (true); |
193 | op->destroy (); |
194 | } |
194 | } |
195 | |
195 | |
196 | void |
196 | void |
197 | poison_more (object *op) |
197 | poison_more (object *op) |
198 | { |
198 | { |
199 | if (op->env == NULL || !QUERY_FLAG (op->env, FLAG_ALIVE) || op->env->stats.hp < 0) |
199 | if (op->env == NULL || !QUERY_FLAG (op->env, FLAG_ALIVE) || op->env->stats.hp < 0) |
200 | { |
200 | { |
201 | op->destroy (true); |
201 | op->destroy (); |
202 | return; |
202 | return; |
203 | } |
203 | } |
204 | |
204 | |
205 | if (op->stats.food == 1) |
205 | if (op->stats.food == 1) |
206 | { |
206 | { |
… | |
… | |
212 | CLEAR_FLAG (op, FLAG_APPLIED); |
212 | CLEAR_FLAG (op, FLAG_APPLIED); |
213 | op->env->update_stats (); |
213 | op->env->update_stats (); |
214 | new_draw_info (NDI_UNIQUE, 0, op->env, "You feel much better now."); |
214 | new_draw_info (NDI_UNIQUE, 0, op->env, "You feel much better now."); |
215 | } |
215 | } |
216 | |
216 | |
217 | op->destroy (true); |
217 | op->destroy (); |
218 | return; |
218 | return; |
219 | } |
219 | } |
220 | |
220 | |
221 | if (op->env->type == PLAYER) |
221 | if (op->env->type == PLAYER) |
222 | { |
222 | { |
… | |
… | |
543 | |
543 | |
544 | if (payload == NULL) |
544 | if (payload == NULL) |
545 | return NULL; |
545 | return NULL; |
546 | |
546 | |
547 | payload->remove (); |
547 | payload->remove (); |
548 | op->destroy (true); |
548 | op->destroy (); |
549 | return payload; |
549 | return payload; |
550 | } |
550 | } |
551 | |
551 | |
552 | case ARROW: |
552 | case ARROW: |
553 | if (op->has_active_speed ()) |
553 | if (op->has_active_speed ()) |
… | |
… | |
580 | fix_stopped_arrow (object *op) |
580 | fix_stopped_arrow (object *op) |
581 | { |
581 | { |
582 | if (rndm (0, 99) < op->stats.food) |
582 | if (rndm (0, 99) < op->stats.food) |
583 | { |
583 | { |
584 | /* Small chance of breaking */ |
584 | /* Small chance of breaking */ |
585 | op->destroy (true); |
585 | op->destroy (); |
586 | return NULL; |
586 | return NULL; |
587 | } |
587 | } |
588 | |
588 | |
589 | op->set_speed (0); |
589 | op->set_speed (0); |
590 | op->direction = 0; |
590 | op->direction = 0; |
… | |
… | |
636 | // replace this by straightforward drop to ground? |
636 | // replace this by straightforward drop to ground? |
637 | object *payload = op->inv; |
637 | object *payload = op->inv; |
638 | |
638 | |
639 | payload->owner = 0; |
639 | payload->owner = 0; |
640 | insert_ob_in_map (payload, op->map, payload, 0); |
640 | insert_ob_in_map (payload, op->map, payload, 0); |
641 | op->destroy (true); |
641 | op->destroy (); |
642 | } |
642 | } |
643 | else |
643 | else |
644 | { |
644 | { |
645 | op = fix_stopped_arrow (op); |
645 | op = fix_stopped_arrow (op); |
646 | |
646 | |
… | |
… | |
657 | int was_reflected; |
657 | int was_reflected; |
658 | |
658 | |
659 | if (!op->map) |
659 | if (!op->map) |
660 | { |
660 | { |
661 | LOG (llevError, "BUG: Arrow had no map.\n"); |
661 | LOG (llevError, "BUG: Arrow had no map.\n"); |
662 | op->destroy (true); |
662 | op->destroy (); |
663 | return; |
663 | return; |
664 | } |
664 | } |
665 | |
665 | |
666 | /* we need to stop thrown objects at some point. Like here. */ |
666 | /* we need to stop thrown objects at some point. Like here. */ |
667 | if (op->type == THROWN_OBJ) |
667 | if (op->type == THROWN_OBJ) |
… | |
… | |
674 | * bomb code, but there are potential other cases where that could happen, |
674 | * bomb code, but there are potential other cases where that could happen, |
675 | * and it is easy enough to clean it up here. |
675 | * and it is easy enough to clean it up here. |
676 | */ |
676 | */ |
677 | if (!op->inv) |
677 | if (!op->inv) |
678 | { |
678 | { |
679 | op->destroy (true); |
679 | op->destroy (); |
680 | return; |
680 | return; |
681 | } |
681 | } |
682 | |
682 | |
683 | if (op->last_sp-- < 0) |
683 | if (op->last_sp-- < 0) |
684 | { |
684 | { |
… | |
… | |
863 | env->insert (tmp); |
863 | env->insert (tmp); |
864 | else |
864 | else |
865 | { |
865 | { |
866 | j = find_first_free_spot (tmp, op->map, op->x, op->y); |
866 | j = find_first_free_spot (tmp, op->map, op->x, op->y); |
867 | if (j < 0) /* No free spot */ |
867 | if (j < 0) /* No free spot */ |
868 | tmp->destroy (true); |
868 | tmp->destroy (); |
869 | else |
869 | else |
870 | { |
870 | { |
871 | mapxy pos (op); pos.move (j); |
871 | mapxy pos (op); pos.move (j); |
872 | |
872 | |
873 | if (pos.normalise ()) |
873 | if (pos.normalise ()) |
874 | pos.insert (tmp, op); |
874 | pos.insert (tmp, op); |
875 | } |
875 | } |
876 | } |
876 | } |
877 | } |
877 | } |
878 | |
878 | |
879 | op->destroy (true); |
879 | op->destroy (); |
880 | } |
880 | } |
881 | |
881 | |
882 | void |
882 | void |
883 | move_teleporter (object *op) |
883 | move_teleporter (object *op) |
884 | { |
884 | { |
… | |
… | |
921 | else if (EXIT_X (head) || EXIT_Y (head)) |
921 | else if (EXIT_X (head) || EXIT_Y (head)) |
922 | { |
922 | { |
923 | if (out_of_map (head->map, EXIT_X (head), EXIT_Y (head))) |
923 | if (out_of_map (head->map, EXIT_X (head), EXIT_Y (head))) |
924 | { |
924 | { |
925 | LOG (llevError, "Removed illegal teleporter.\n"); |
925 | LOG (llevError, "Removed illegal teleporter.\n"); |
926 | head->destroy (true); |
926 | head->destroy (); |
927 | return; |
927 | return; |
928 | } |
928 | } |
929 | |
929 | |
930 | if (INVOKE_OBJECT (TRIGGER, op, ARG_OBJECT (tmp))) |
930 | if (INVOKE_OBJECT (TRIGGER, op, ARG_OBJECT (tmp))) |
931 | return; |
931 | return; |
… | |
… | |
1125 | for (tmp = op->above; tmp; tmp = tmp->above) |
1125 | for (tmp = op->above; tmp; tmp = tmp->above) |
1126 | { |
1126 | { |
1127 | if (op->other_arch->archname == tmp->arch->archname) |
1127 | if (op->other_arch->archname == tmp->arch->archname) |
1128 | { |
1128 | { |
1129 | if (op->level <= 0) |
1129 | if (op->level <= 0) |
1130 | tmp->destroy (true); |
1130 | tmp->destroy (); |
1131 | else |
1131 | else |
1132 | { |
1132 | { |
1133 | uint64 new_nrof = (uint64) tmp->nrof * op->level; |
1133 | uint64 new_nrof = (uint64) tmp->nrof * op->level; |
1134 | |
1134 | |
1135 | if (new_nrof >= 1UL << 31) |
1135 | if (new_nrof >= 1UL << 31) |
… | |
… | |
1231 | { |
1231 | { |
1232 | if (object *tmp = op->ms ().player ()) |
1232 | if (object *tmp = op->ms ().player ()) |
1233 | { |
1233 | { |
1234 | /* remove an old force with a slaying field == op->name */ |
1234 | /* remove an old force with a slaying field == op->name */ |
1235 | if (object *force = tmp->force_find (op->name)) |
1235 | if (object *force = tmp->force_find (op->name)) |
1236 | force->destroy (true); |
1236 | force->destroy (); |
1237 | |
1237 | |
1238 | if (!tmp->force_find (op->slaying)) |
1238 | if (!tmp->force_find (op->slaying)) |
1239 | { |
1239 | { |
1240 | tmp->force_add (op->slaying, op->stats.food); |
1240 | tmp->force_add (op->slaying, op->stats.food); |
1241 | |
1241 | |
… | |
… | |
1247 | op->stats.hp--; |
1247 | op->stats.hp--; |
1248 | |
1248 | |
1249 | if (op->stats.hp == 0) |
1249 | if (op->stats.hp == 0) |
1250 | { |
1250 | { |
1251 | /* marker expires--granted mark number limit */ |
1251 | /* marker expires--granted mark number limit */ |
1252 | op->destroy (true); |
1252 | op->destroy (); |
1253 | return; |
1253 | return; |
1254 | } |
1254 | } |
1255 | } |
1255 | } |
1256 | } |
1256 | } |
1257 | } |
1257 | } |