… | |
… | |
467 | |
467 | |
468 | if (op != NULL && op->map) |
468 | if (op != NULL && op->map) |
469 | if ((get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_NO_CLERIC) && (!QUERY_FLAG (op, FLAG_WIZCAST))) |
469 | if ((get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_NO_CLERIC) && (!QUERY_FLAG (op, FLAG_WIZCAST))) |
470 | new_draw_info (NDI_UNIQUE, 0, op, "You feel something fizzle inside you."); |
470 | new_draw_info (NDI_UNIQUE, 0, op, "You feel something fizzle inside you."); |
471 | else |
471 | else |
472 | enter_exit (op, wor); |
472 | op->enter_exit (wor); |
473 | |
473 | |
474 | wor->destroy (); |
474 | wor->destroy (); |
475 | } |
475 | } |
476 | |
476 | |
477 | /* Word of recall causes the player to return 'home'. |
477 | /* Word of recall causes the player to return 'home'. |
… | |
… | |
639 | cast_create_town_portal (object *op, object *caster, object *spell, int dir) |
639 | cast_create_town_portal (object *op, object *caster, object *spell, int dir) |
640 | { |
640 | { |
641 | object *dummy, *force, *old_force, *tmp; |
641 | object *dummy, *force, *old_force, *tmp; |
642 | archetype *perm_portal; |
642 | archetype *perm_portal; |
643 | char portal_name[1024], portal_message[1024]; |
643 | char portal_name[1024], portal_message[1024]; |
644 | sint16 exitx, exity; |
|
|
645 | maptile *exitmap; |
644 | maptile *exitmap; |
646 | int op_level; |
645 | int op_level; |
647 | |
646 | |
648 | /* Check to see if the map the player is currently on is a per player unique |
647 | /* Check to see if the map the player is currently on is a per player unique |
649 | * map. This can be determined in that per player unique maps have the |
648 | * map. This can be determined in that per player unique maps have the |
… | |
… | |
719 | * If it has the good name, we destruct it. |
718 | * If it has the good name, we destruct it. |
720 | * -We destruct the force indicating that portal. |
719 | * -We destruct the force indicating that portal. |
721 | */ |
720 | */ |
722 | while ((old_force = check_inv_recursive (op, dummy))) |
721 | while ((old_force = check_inv_recursive (op, dummy))) |
723 | { |
722 | { |
724 | exitx = EXIT_X (old_force); |
723 | exitmap = maptile::find_map (old_force->race, op->map); |
725 | exity = EXIT_Y (old_force); |
|
|
726 | LOG (llevDebug, "Trying to kill a portal in %s (%d,%d)\n", &old_force->race, exitx, exity); |
|
|
727 | |
|
|
728 | if (!strncmp (old_force->race, settings.localdir, strlen (settings.localdir))) |
|
|
729 | exitmap = ready_map_name (old_force->race, MAP_PLAYER_UNIQUE); |
|
|
730 | else |
|
|
731 | exitmap = ready_map_name (old_force->race, 0); |
|
|
732 | |
724 | |
733 | if (exitmap) |
725 | if (exitmap) |
734 | { |
726 | { |
|
|
727 | int exitx = EXIT_X (old_force); |
|
|
728 | int exity = EXIT_Y (old_force); |
|
|
729 | |
735 | tmp = present_arch (perm_portal, exitmap, exitx, exity); |
730 | tmp = present_arch (perm_portal, exitmap, exitx, exity); |
736 | while (tmp) |
731 | while (tmp) |
737 | { |
732 | { |
738 | if (tmp->name == old_force->name) |
733 | if (tmp->name == old_force->name) |
739 | { |
734 | { |
… | |
… | |
744 | tmp = tmp->above; |
739 | tmp = tmp->above; |
745 | } |
740 | } |
746 | } |
741 | } |
747 | |
742 | |
748 | old_force->destroy (); |
743 | old_force->destroy (); |
749 | LOG (llevDebug, "\n"); |
|
|
750 | } |
744 | } |
751 | |
745 | |
752 | dummy->destroy (); |
746 | dummy->destroy (); |
753 | |
747 | |
754 | /* Creating the portals. |
748 | /* Creating the portals. |
… | |
… | |
760 | * 'force' is the destination of the town portal, which we got |
754 | * 'force' is the destination of the town portal, which we got |
761 | * from the players inventory above. |
755 | * from the players inventory above. |
762 | */ |
756 | */ |
763 | |
757 | |
764 | /* Ensure exit map is loaded */ |
758 | /* Ensure exit map is loaded */ |
765 | if (!strncmp (force->name, settings.localdir, strlen (settings.localdir))) |
|
|
766 | exitmap = ready_map_name (force->name, MAP_PLAYER_UNIQUE); |
|
|
767 | else |
|
|
768 | exitmap = ready_map_name (force->name, 0); |
759 | exitmap = maptile::find_map (force->name, 0); |
769 | |
760 | |
770 | /* If we were unable to load (ex. random map deleted), warn player */ |
761 | /* If we were unable to load (ex. random map deleted), warn player */ |
771 | if (exitmap == NULL) |
762 | if (!exitmap) |
772 | { |
763 | { |
773 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, op, "Something strange happens.\nYou can't remember where to go!?"); |
764 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, op, "Something strange happens.\nYou can't remember where to go!?"); |
774 | force->destroy (); |
765 | force->destroy (); |
775 | return 1; |
766 | return 1; |
776 | } |
767 | } |
… | |
… | |
791 | |
782 | |
792 | /* Create a portal in front of player |
783 | /* Create a portal in front of player |
793 | * dummy contain the portal and |
784 | * dummy contain the portal and |
794 | * force contain the track to kill it later |
785 | * force contain the track to kill it later |
795 | */ |
786 | */ |
796 | |
|
|
797 | snprintf (portal_name, 1024, "%s's portal to %s", &op->name, &force->name); |
787 | snprintf (portal_name, 1024, "%s's portal to %s", &op->name, &force->name); |
798 | dummy = get_archetype (spell->slaying); /*The portal */ |
788 | dummy = get_archetype (spell->slaying); /*The portal */ |
799 | if (dummy == NULL) |
789 | if (dummy == NULL) |
800 | { |
790 | { |
801 | new_draw_info (NDI_UNIQUE, 0, op, "Oops, program error!"); |
791 | new_draw_info (NDI_UNIQUE, 0, op, "Oops, program error!"); |
… | |
… | |
833 | * dummy contain the portal and |
823 | * dummy contain the portal and |
834 | * force the track to kill it later |
824 | * force the track to kill it later |
835 | * the 'force' variable still contains the 'reminder' of |
825 | * the 'force' variable still contains the 'reminder' of |
836 | * where this portal goes to. |
826 | * where this portal goes to. |
837 | */ |
827 | */ |
838 | snprintf (portal_name, 1024, "%s's portal to %s", &op->name, op->map->path); |
828 | snprintf (portal_name, 1024, "%s's portal to %s", &op->name, &op->map->path); |
839 | dummy = get_archetype (spell->slaying); /*The portal */ |
829 | dummy = get_archetype (spell->slaying); /*The portal */ |
840 | if (dummy == NULL) |
830 | if (dummy == NULL) |
841 | { |
831 | { |
842 | new_draw_info (NDI_UNIQUE, 0, op, "Oops, program error!"); |
832 | new_draw_info (NDI_UNIQUE, 0, op, "Oops, program error!"); |
843 | LOG (llevError, "object::create failed (perm_magic_portal) in cast_create_town_portal for %s!\n", &op->name); |
833 | LOG (llevError, "object::create failed (perm_magic_portal) in cast_create_town_portal for %s!\n", &op->name); |
… | |
… | |
2477 | int success; |
2467 | int success; |
2478 | |
2468 | |
2479 | if (!op->map) |
2469 | if (!op->map) |
2480 | return 0; /* shouldnt happen */ |
2470 | return 0; /* shouldnt happen */ |
2481 | |
2471 | |
2482 | success = change_map_light (op->map, spell->stats.dam); |
2472 | success = op->map->change_map_light (spell->stats.dam); |
|
|
2473 | |
2483 | if (!success) |
2474 | if (!success) |
2484 | { |
2475 | { |
2485 | if (spell->stats.dam < 0) |
2476 | if (spell->stats.dam < 0) |
2486 | new_draw_info (NDI_UNIQUE, 0, op, "It can be no brighter here."); |
2477 | new_draw_info (NDI_UNIQUE, 0, op, "It can be no brighter here."); |
2487 | else |
2478 | else |