… | |
… | |
669 | } |
669 | } |
670 | |
670 | |
671 | void |
671 | void |
672 | remove_monsters (int x, int y, maptile *map) |
672 | remove_monsters (int x, int y, maptile *map) |
673 | { |
673 | { |
674 | object *tmp; |
|
|
675 | |
|
|
676 | for (tmp = GET_MAP_OB (map, x, y); tmp; tmp = tmp->above) |
674 | for (object *tmp = GET_MAP_OB (map, x, y); tmp; ) |
677 | if (QUERY_FLAG (tmp, FLAG_ALIVE)) |
|
|
678 | { |
675 | { |
679 | if (tmp->head) |
676 | object *next = tmp->above; |
680 | tmp = tmp->head; |
677 | |
681 | tmp->remove (); |
678 | if (tmp->flag [FLAG_ALIVE]) |
682 | tmp->destroy (); |
679 | tmp->head_ ()->destroy (); |
683 | tmp = GET_MAP_OB (map, x, y); |
680 | |
684 | if (tmp == NULL) |
681 | tmp = next; |
685 | break; |
|
|
686 | }; |
682 | } |
687 | } |
683 | } |
688 | |
684 | |
689 | /* surrounds the point x,y by doors, so as to enclose something, like |
685 | /* surrounds the point x,y by doors, so as to enclose something, like |
690 | a chest. It only goes as far as the 8 squares surrounding, and |
686 | a chest. It only goes as far as the 8 squares surrounding, and |
691 | it'll remove any monsters it finds.*/ |
687 | it'll remove any monsters it finds.*/ |
… | |
… | |
820 | |
816 | |
821 | /* lock the doors and hide the keys. */ |
817 | /* lock the doors and hide the keys. */ |
822 | |
818 | |
823 | if (opts & DOORED) |
819 | if (opts & DOORED) |
824 | { |
820 | { |
825 | for (i = 0, door = doorlist[0]; doorlist[i] != NULL; i++) |
821 | for (i = 0, door = doorlist[0]; doorlist[i]; i++) |
826 | { |
822 | { |
827 | object *new_door = get_archetype (shstr_locked_door1); |
823 | object *new_door = get_archetype (shstr_locked_door1); |
828 | |
824 | |
829 | door = doorlist[i]; |
825 | door = doorlist[i]; |
830 | new_door->face = door->face; |
826 | new_door->face = door->face; |
831 | new_door->x = door->x; |
827 | new_door->x = door->x; |
832 | new_door->y = door->y; |
828 | new_door->y = door->y; |
833 | door->remove (); |
|
|
834 | door->destroy (); |
829 | door->destroy (); |
835 | doorlist[i] = new_door; |
830 | doorlist[i] = new_door; |
836 | insert_ob_in_map (new_door, map, NULL, 0); |
831 | insert_ob_in_map (new_door, map, NULL, 0); |
837 | new_door->slaying = format ("RMG-%d-%d", (int)rmg_rndm (1000000000), (int)rmg_rndm (1000000000)); |
832 | new_door->slaying = format ("RMG-%d-%d", (int)rmg_rndm (1000000000), (int)rmg_rndm (1000000000)); |
838 | keyplace (map, new_door->x, new_door->y, new_door->slaying, NO_PASS_DOORS, 2, RP); |
833 | keyplace (map, new_door->x, new_door->y, new_door->slaying, NO_PASS_DOORS, 2, RP); |
… | |
… | |
855 | retrofit_joined_wall (map, door->x, door->y - 1, 0, RP); |
850 | retrofit_joined_wall (map, door->x, door->y - 1, 0, RP); |
856 | retrofit_joined_wall (map, door->x, door->y + 1, 0, RP); |
851 | retrofit_joined_wall (map, door->x, door->y + 1, 0, RP); |
857 | |
852 | |
858 | door->face = wallface->face; |
853 | door->face = wallface->face; |
859 | |
854 | |
860 | if (!QUERY_FLAG (wallface, FLAG_REMOVED)) |
|
|
861 | wallface->remove (); |
|
|
862 | |
|
|
863 | wallface->destroy (); |
855 | wallface->destroy (); |
864 | } |
856 | } |
865 | } |
857 | } |
866 | } |
858 | } |
867 | } |
859 | } |