… | |
… | |
662 | { |
662 | { |
663 | new_draw_info (NDI_UNIQUE, 0, op, "Oops, program error!"); |
663 | new_draw_info (NDI_UNIQUE, 0, op, "Oops, program error!"); |
664 | LOG (llevError, "object::create failed (force in cast_create_town_portal for %s!\n", &op->name); |
664 | LOG (llevError, "object::create failed (force in cast_create_town_portal for %s!\n", &op->name); |
665 | return 0; |
665 | return 0; |
666 | } |
666 | } |
|
|
667 | |
667 | force = check_inv_recursive (op, dummy); |
668 | force = check_inv_recursive (op, dummy); |
668 | |
669 | |
669 | if (force == NULL) |
670 | if (force == NULL) |
670 | { |
671 | { |
671 | /* Here we know there is no destination marked up. |
672 | /* Here we know there is no destination marked up. |
… | |
… | |
705 | { |
706 | { |
706 | new_draw_info (NDI_UNIQUE, 0, op, "Oops, program error!"); |
707 | new_draw_info (NDI_UNIQUE, 0, op, "Oops, program error!"); |
707 | LOG (llevError, "object::create failed (force) in cast_create_town_portal for %s!\n", &op->name); |
708 | LOG (llevError, "object::create failed (force) in cast_create_town_portal for %s!\n", &op->name); |
708 | return 0; |
709 | return 0; |
709 | } |
710 | } |
|
|
711 | |
710 | perm_portal = archetype::find (spell->slaying); |
712 | perm_portal = archetype::find (spell->slaying); |
711 | |
713 | |
712 | /* To kill a town portal, we go trough the player's inventory, |
714 | /* To kill a town portal, we go trough the player's inventory, |
713 | * for each marked portal in player's inventory, |
715 | * for each marked portal in player's inventory, |
714 | * -We try load the associated map (if impossible, consider the portal destructed) |
716 | * -We try load the associated map (if impossible, consider the portal destructed) |
… | |
… | |
797 | { |
799 | { |
798 | new_draw_info (NDI_UNIQUE, 0, op, "Oops, program error!"); |
800 | new_draw_info (NDI_UNIQUE, 0, op, "Oops, program error!"); |
799 | LOG (llevError, "object::create failed (perm_magic_portal) in cast_create_town_portal for %s!\n", &op->name); |
801 | LOG (llevError, "object::create failed (perm_magic_portal) in cast_create_town_portal for %s!\n", &op->name); |
800 | return 0; |
802 | return 0; |
801 | } |
803 | } |
|
|
804 | |
802 | EXIT_PATH (dummy) = force->name; |
805 | EXIT_PATH (dummy) = force->name; |
803 | EXIT_X (dummy) = EXIT_X (force); |
806 | EXIT_X (dummy) = EXIT_X (force); |
804 | EXIT_Y (dummy) = EXIT_Y (force); |
807 | EXIT_Y (dummy) = EXIT_Y (force); |
805 | dummy->name = dummy->name_pl = portal_name; |
808 | dummy->name = dummy->name_pl = portal_name; |
806 | dummy->msg = portal_message; |
809 | dummy->msg = portal_message; |
… | |
… | |
816 | { |
819 | { |
817 | new_draw_info (NDI_UNIQUE, 0, op, "Oops, program error!"); |
820 | new_draw_info (NDI_UNIQUE, 0, op, "Oops, program error!"); |
818 | LOG (llevError, "object::create failed (force) in cast_create_town_portal for %s!\n", &op->name); |
821 | LOG (llevError, "object::create failed (force) in cast_create_town_portal for %s!\n", &op->name); |
819 | return 0; |
822 | return 0; |
820 | } |
823 | } |
|
|
824 | |
821 | tmp->race = op->map->path; |
825 | tmp->race = op->map->path; |
822 | tmp->name = portal_name; |
826 | tmp->name = portal_name; |
823 | EXIT_X (tmp) = dummy->x; |
827 | EXIT_X (tmp) = dummy->x; |
824 | EXIT_Y (tmp) = dummy->y; |
828 | EXIT_Y (tmp) = dummy->y; |
825 | insert_ob_in_ob (tmp, op); |
829 | insert_ob_in_ob (tmp, op); |
… | |
… | |
836 | { |
840 | { |
837 | new_draw_info (NDI_UNIQUE, 0, op, "Oops, program error!"); |
841 | new_draw_info (NDI_UNIQUE, 0, op, "Oops, program error!"); |
838 | LOG (llevError, "object::create failed (perm_magic_portal) in cast_create_town_portal for %s!\n", &op->name); |
842 | LOG (llevError, "object::create failed (perm_magic_portal) in cast_create_town_portal for %s!\n", &op->name); |
839 | return 0; |
843 | return 0; |
840 | } |
844 | } |
|
|
845 | |
841 | EXIT_PATH (dummy) = op->map->path; |
846 | EXIT_PATH (dummy) = op->map->path; |
842 | EXIT_X (dummy) = op->x; |
847 | EXIT_X (dummy) = op->x; |
843 | EXIT_Y (dummy) = op->y; |
848 | EXIT_Y (dummy) = op->y; |
844 | dummy->name = dummy->name_pl = portal_name; |
849 | dummy->name = dummy->name_pl = portal_name; |
845 | dummy->msg = portal_message; |
850 | dummy->msg = portal_message; |
… | |
… | |
856 | { |
861 | { |
857 | new_draw_info (NDI_UNIQUE, 0, op, "Oops, program error!"); |
862 | new_draw_info (NDI_UNIQUE, 0, op, "Oops, program error!"); |
858 | LOG (llevError, "object::create failed (force) in cast_create_town_portal for %s!\n", &op->name); |
863 | LOG (llevError, "object::create failed (force) in cast_create_town_portal for %s!\n", &op->name); |
859 | return 0; |
864 | return 0; |
860 | } |
865 | } |
|
|
866 | |
861 | tmp->race = force->name; |
867 | tmp->race = force->name; |
862 | tmp->name = portal_name; |
868 | tmp->name = portal_name; |
863 | EXIT_X (tmp) = dummy->x; |
869 | EXIT_X (tmp) = dummy->x; |
864 | EXIT_Y (tmp) = dummy->y; |
870 | EXIT_Y (tmp) = dummy->y; |
865 | insert_ob_in_ob (tmp, op); |
871 | insert_ob_in_ob (tmp, op); |
… | |
… | |
998 | m = tmp->map; |
1004 | m = tmp->map; |
999 | |
1005 | |
1000 | if (!(get_map_flags (m, &m, x, y, &x, &y) & (P_OUT_OF_MAP | P_IS_ALIVE)) && |
1006 | if (!(get_map_flags (m, &m, x, y, &x, &y) & (P_OUT_OF_MAP | P_IS_ALIVE)) && |
1001 | ((spell_ob->move_block & GET_MAP_MOVE_BLOCK (m, x, y)) != spell_ob->move_block) && !posblocked) |
1007 | ((spell_ob->move_block & GET_MAP_MOVE_BLOCK (m, x, y)) != spell_ob->move_block) && !posblocked) |
1002 | { |
1008 | { |
1003 | tmp2 = object::create (); |
1009 | tmp2 = tmp->clone (); |
1004 | tmp->copy_to (tmp2); |
|
|
1005 | tmp2->x = x; |
1010 | tmp2->x = x; |
1006 | tmp2->y = y; |
1011 | tmp2->y = y; |
1007 | insert_ob_in_map (tmp2, m, op, 0); |
1012 | insert_ob_in_map (tmp2, m, op, 0); |
1008 | /* If this is a spellcasting wall, need to insert the spell object */ |
1013 | /* If this is a spellcasting wall, need to insert the spell object */ |
1009 | if (tmp2->other_arch && tmp2->other_arch->clone.type == SPELL) |
1014 | if (tmp2->other_arch && tmp2->other_arch->clone.type == SPELL) |
… | |
… | |
1018 | m = tmp->map; |
1023 | m = tmp->map; |
1019 | |
1024 | |
1020 | if (!(get_map_flags (m, &m, x, y, &x, &y) & (P_OUT_OF_MAP | P_IS_ALIVE)) && |
1025 | if (!(get_map_flags (m, &m, x, y, &x, &y) & (P_OUT_OF_MAP | P_IS_ALIVE)) && |
1021 | ((spell_ob->move_block & GET_MAP_MOVE_BLOCK (m, x, y)) != spell_ob->move_block) && !negblocked) |
1026 | ((spell_ob->move_block & GET_MAP_MOVE_BLOCK (m, x, y)) != spell_ob->move_block) && !negblocked) |
1022 | { |
1027 | { |
1023 | tmp2 = object::create (); |
1028 | tmp2 = tmp->clone (); |
1024 | tmp->copy_to (tmp2); |
|
|
1025 | tmp2->x = x; |
1029 | tmp2->x = x; |
1026 | tmp2->y = y; |
1030 | tmp2->y = y; |
1027 | insert_ob_in_map (tmp2, m, op, 0); |
1031 | insert_ob_in_map (tmp2, m, op, 0); |
1028 | if (tmp2->other_arch && tmp2->other_arch->clone.type == SPELL) |
1032 | if (tmp2->other_arch && tmp2->other_arch->clone.type == SPELL) |
1029 | insert_ob_in_ob (arch_to_object (tmp2->other_arch), tmp2); |
1033 | insert_ob_in_ob (arch_to_object (tmp2->other_arch), tmp2); |
… | |
… | |
1634 | if (x == op->x && y == op->y && op->map == m) |
1638 | if (x == op->x && y == op->y && op->map == m) |
1635 | flag = INS_BELOW_ORIGINATOR; |
1639 | flag = INS_BELOW_ORIGINATOR; |
1636 | |
1640 | |
1637 | if (small_nuggets) |
1641 | if (small_nuggets) |
1638 | { |
1642 | { |
1639 | tmp = object::create (); |
1643 | tmp = small->clone (); |
1640 | small->copy_to (tmp); |
|
|
1641 | tmp->nrof = small_nuggets; |
1644 | tmp->nrof = small_nuggets; |
1642 | tmp->x = x; |
1645 | tmp->x = x; |
1643 | tmp->y = y; |
1646 | tmp->y = y; |
1644 | insert_ob_in_map (tmp, m, op, flag); |
1647 | insert_ob_in_map (tmp, m, op, flag); |
1645 | } |
1648 | } |
|
|
1649 | |
1646 | if (large_nuggets) |
1650 | if (large_nuggets) |
1647 | { |
1651 | { |
1648 | tmp = object::create (); |
1652 | tmp = large->clone (); |
1649 | large->copy_to (tmp); |
|
|
1650 | tmp->nrof = large_nuggets; |
1653 | tmp->nrof = large_nuggets; |
1651 | tmp->x = x; |
1654 | tmp->x = x; |
1652 | tmp->y = y; |
1655 | tmp->y = y; |
1653 | insert_ob_in_map (tmp, m, op, flag); |
1656 | insert_ob_in_map (tmp, m, op, flag); |
1654 | } |
1657 | } |