--- deliantra/server/server/spell_effect.C 2006/12/31 10:28:37 1.30 +++ deliantra/server/server/spell_effect.C 2007/01/04 16:19:32 1.31 @@ -453,25 +453,26 @@ hit_player (tmp, 9998, op, AT_PHYSICAL, 0); } } + return 1; } - void execute_word_of_recall (object *op) { - object *wor = op; - - while (op != NULL && op->type != PLAYER) - op = op->env; - - if (op != NULL && op->map) - if ((get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_NO_CLERIC) && (!QUERY_FLAG (op, FLAG_WIZCAST))) - new_draw_info (NDI_UNIQUE, 0, op, "You feel something fizzle inside you."); - else - op->enter_exit (wor); + if (object *pl = op->in_player ()) + { + if (pl->ms ().flags () & P_NO_CLERIC && !QUERY_FLAG (pl, FLAG_WIZCAST)) + new_draw_info (NDI_UNIQUE, 0, pl, "You feel something fizzle inside you."); + else + { + // remove first so we do not call update_stats + op->remove (); + pl->enter_exit (op); + } + } - wor->destroy (); + op->destroy (); } /* Word of recall causes the player to return 'home'. @@ -521,8 +522,10 @@ EXIT_X (dummy) = op->contr->bed_x; EXIT_Y (dummy) = op->contr->bed_y; - (void) insert_ob_in_ob (dummy, op); + op->insert (dummy); + new_draw_info (NDI_UNIQUE, 0, op, "You feel a force starting to build up inside you."); + return 1; } @@ -639,7 +642,7 @@ int cast_create_town_portal (object *op, object *caster, object *spell, int dir) { - object *dummy, *force, *old_force, *tmp; + object *dummy, *force, *old_force; archetype *perm_portal; char portal_name[1024], portal_message[1024]; maptile *exitmap; @@ -721,23 +724,22 @@ */ while ((old_force = check_inv_recursive (op, dummy))) { - exitmap = maptile::load_map_sync (old_force->race, op->map); + exitmap = maptile::find_sync (old_force->race, op->map); if (exitmap) { + exitmap->load_sync (); + int exitx = EXIT_X (old_force); int exity = EXIT_Y (old_force); - tmp = present_arch (perm_portal, exitmap, exitx, exity); - while (tmp) + for (object *tmp = present_arch (perm_portal, exitmap, exitx, exity); tmp; tmp = tmp->above) { if (tmp->name == old_force->name) { tmp->destroy (); break; } - - tmp = tmp->above; } } @@ -757,7 +759,7 @@ */ /* Ensure exit map is loaded */ - exitmap = maptile::load_map_sync (force->name); + exitmap = maptile::find_sync (force->name); /* If we were unable to load (ex. random map deleted), warn player */ if (!exitmap) @@ -767,6 +769,8 @@ return 1; } + exitmap->load_sync (); + op_level = caster_level (caster, spell); if (op_level < 15) snprintf (portal_message, 1024, @@ -806,8 +810,9 @@ * object, so on future castings, we can know that he has an active * town portal. */ - tmp = get_archetype (spell->race); - if (tmp == NULL) + object *tmp = get_archetype (spell->race); + + if (!tmp) { new_draw_info (NDI_UNIQUE, 0, op, "Oops, program error!"); LOG (llevError, "object::create failed (force) in cast_create_town_portal for %s!\n", &op->name);