… | |
… | |
148 | the_key->destroy (); |
148 | the_key->destroy (); |
149 | return 1; |
149 | return 1; |
150 | } |
150 | } |
151 | } |
151 | } |
152 | |
152 | |
153 | LOG(llevError, "key %d,%d %p\n", the_keymaster ? the_keymaster->x : x, the_keymaster ? the_keymaster->y : y, the_keymaster+0);//D |
|
|
154 | if (the_keymaster) |
153 | if (the_keymaster) |
155 | the_keymaster->head_ ()->insert (the_key); |
154 | the_keymaster->head_ ()->insert (the_key); |
156 | else |
155 | else |
157 | { |
156 | { |
158 | the_key->x = kx; |
157 | the_key->x = kx; |
… | |
… | |
670 | } |
669 | } |
671 | |
670 | |
672 | void |
671 | void |
673 | remove_monsters (int x, int y, maptile *map) |
672 | remove_monsters (int x, int y, maptile *map) |
674 | { |
673 | { |
675 | object *tmp; |
|
|
676 | |
|
|
677 | for (tmp = GET_MAP_OB (map, x, y); tmp; tmp = tmp->above) |
674 | for (object *tmp = GET_MAP_OB (map, x, y); tmp; ) |
678 | if (QUERY_FLAG (tmp, FLAG_ALIVE)) |
|
|
679 | { |
675 | { |
680 | if (tmp->head) |
676 | object *next = tmp->above; |
681 | tmp = tmp->head; |
677 | |
682 | tmp->remove (); |
678 | if (tmp->flag [FLAG_ALIVE]) |
683 | tmp->destroy (); |
679 | tmp->head_ ()->destroy (); |
684 | tmp = GET_MAP_OB (map, x, y); |
680 | |
685 | if (tmp == NULL) |
681 | tmp = next; |
686 | break; |
|
|
687 | }; |
682 | } |
688 | } |
683 | } |
689 | |
684 | |
690 | /* 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 |
691 | 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 |
692 | it'll remove any monsters it finds.*/ |
687 | it'll remove any monsters it finds.*/ |
… | |
… | |
821 | |
816 | |
822 | /* lock the doors and hide the keys. */ |
817 | /* lock the doors and hide the keys. */ |
823 | |
818 | |
824 | if (opts & DOORED) |
819 | if (opts & DOORED) |
825 | { |
820 | { |
826 | for (i = 0, door = doorlist[0]; doorlist[i] != NULL; i++) |
821 | for (i = 0, door = doorlist[0]; doorlist[i]; i++) |
827 | { |
822 | { |
828 | object *new_door = get_archetype (shstr_locked_door1); |
823 | object *new_door = get_archetype (shstr_locked_door1); |
829 | |
824 | |
830 | door = doorlist[i]; |
825 | door = doorlist[i]; |
831 | new_door->face = door->face; |
826 | new_door->face = door->face; |
832 | new_door->x = door->x; |
827 | new_door->x = door->x; |
833 | new_door->y = door->y; |
828 | new_door->y = door->y; |
834 | door->remove (); |
|
|
835 | door->destroy (); |
829 | door->destroy (); |
836 | doorlist[i] = new_door; |
830 | doorlist[i] = new_door; |
837 | insert_ob_in_map (new_door, map, NULL, 0); |
831 | insert_ob_in_map (new_door, map, NULL, 0); |
838 | 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)); |
839 | 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); |
… | |
… | |
856 | retrofit_joined_wall (map, door->x, door->y - 1, 0, RP); |
850 | retrofit_joined_wall (map, door->x, door->y - 1, 0, RP); |
857 | retrofit_joined_wall (map, door->x, door->y + 1, 0, RP); |
851 | retrofit_joined_wall (map, door->x, door->y + 1, 0, RP); |
858 | |
852 | |
859 | door->face = wallface->face; |
853 | door->face = wallface->face; |
860 | |
854 | |
861 | if (!QUERY_FLAG (wallface, FLAG_REMOVED)) |
|
|
862 | wallface->remove (); |
|
|
863 | |
|
|
864 | wallface->destroy (); |
855 | wallface->destroy (); |
865 | } |
856 | } |
866 | } |
857 | } |
867 | } |
858 | } |
868 | } |
859 | } |