… | |
… | |
239 | for (i = 0; i < NUM_STATS; i++) |
239 | for (i = 0; i < NUM_STATS; i++) |
240 | if (get_attr_value (&depl->stats, i)) |
240 | if (get_attr_value (&depl->stats, i)) |
241 | { |
241 | { |
242 | new_draw_info (NDI_UNIQUE, 0, op, restore_msg[i]); |
242 | new_draw_info (NDI_UNIQUE, 0, op, restore_msg[i]); |
243 | } |
243 | } |
244 | remove_ob (depl); |
244 | depl->remove (); |
245 | free_object (depl); |
245 | depl->destroy (0); |
246 | fix_player (op); |
246 | fix_player (op); |
247 | } |
247 | } |
248 | else |
248 | else |
249 | new_draw_info (NDI_UNIQUE, 0, op, "You potion had no effect."); |
249 | new_draw_info (NDI_UNIQUE, 0, op, "You potion had no effect."); |
250 | |
250 | |
… | |
… | |
952 | price_in = nr * CONV_NEED (converter) * item->value; |
952 | price_in = nr * CONV_NEED (converter) * item->value; |
953 | } |
953 | } |
954 | else |
954 | else |
955 | { |
955 | { |
956 | price_in = item->value; |
956 | price_in = item->value; |
957 | remove_ob (item); |
957 | item->remove (); |
958 | free_object (item); |
958 | item->destroy (0); |
959 | } |
959 | } |
960 | } |
960 | } |
961 | |
961 | |
962 | if (converter->inv != NULL) |
962 | if (converter->inv != NULL) |
963 | { |
963 | { |
… | |
… | |
1078 | { |
1078 | { |
1079 | sack->move_off = 0; |
1079 | sack->move_off = 0; |
1080 | tmp = sack->inv; |
1080 | tmp = sack->inv; |
1081 | if (tmp && tmp->type == CLOSE_CON) |
1081 | if (tmp && tmp->type == CLOSE_CON) |
1082 | { |
1082 | { |
1083 | remove_ob (tmp); |
1083 | tmp->remove (); |
1084 | free_object (tmp); |
1084 | tmp->destroy (0); |
1085 | } |
1085 | } |
1086 | } |
1086 | } |
1087 | } |
1087 | } |
1088 | } |
1088 | } |
1089 | |
1089 | |
… | |
… | |
1346 | |
1346 | |
1347 | if (QUERY_FLAG (tmp, FLAG_UNPAID)) |
1347 | if (QUERY_FLAG (tmp, FLAG_UNPAID)) |
1348 | { |
1348 | { |
1349 | int i = find_free_spot (tmp, op->map, op->x, op->y, 1, 9); |
1349 | int i = find_free_spot (tmp, op->map, op->x, op->y, 1, 9); |
1350 | |
1350 | |
1351 | remove_ob (tmp); |
1351 | tmp->remove (); |
1352 | |
1352 | |
1353 | if (i == -1) |
1353 | if (i == -1) |
1354 | i = 0; |
1354 | i = 0; |
1355 | |
1355 | |
1356 | tmp->map = op->map; |
1356 | tmp->map = op->map; |
… | |
… | |
1420 | { |
1420 | { |
1421 | LOG (llevError, "Internal shop-mat problem.\n"); |
1421 | LOG (llevError, "Internal shop-mat problem.\n"); |
1422 | } |
1422 | } |
1423 | else |
1423 | else |
1424 | { |
1424 | { |
1425 | remove_ob (op); |
1425 | op->remove (); |
1426 | op->x += freearr_x[i]; |
1426 | op->x += freearr_x[i]; |
1427 | op->y += freearr_y[i]; |
1427 | op->y += freearr_y[i]; |
1428 | rv = insert_ob_in_map (op, op->map, shop_mat, 0) == NULL; |
1428 | rv = insert_ob_in_map (op, op->map, shop_mat, 0) == NULL; |
1429 | } |
1429 | } |
1430 | } |
1430 | } |
… | |
… | |
1887 | } |
1887 | } |
1888 | |
1888 | |
1889 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "You lose knowledge of %s.", spell); |
1889 | new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "You lose knowledge of %s.", spell); |
1890 | player_unready_range_ob (op->contr, spob); |
1890 | player_unready_range_ob (op->contr, spob); |
1891 | esrv_remove_spell (op->contr, spob); |
1891 | esrv_remove_spell (op->contr, spob); |
1892 | remove_ob (spob); |
1892 | spob->remove (); |
1893 | free_object (spob); |
1893 | spob->destroy (0); |
1894 | } |
1894 | } |
1895 | |
1895 | |
1896 | /** |
1896 | /** |
1897 | * Handles player applying a spellbook. |
1897 | * Handles player applying a spellbook. |
1898 | * Checks whether player has knowledge of required skill, doesn't already know the spell, |
1898 | * Checks whether player has knowledge of required skill, doesn't already know the spell, |
… | |
… | |
2104 | } |
2104 | } |
2105 | while (tmp->inv) |
2105 | while (tmp->inv) |
2106 | { |
2106 | { |
2107 | treas = tmp->inv; |
2107 | treas = tmp->inv; |
2108 | |
2108 | |
2109 | remove_ob (treas); |
2109 | treas->remove (); |
2110 | new_draw_info_format (NDI_UNIQUE, 0, op, "You find %s in the chest.", query_name (treas)); |
2110 | new_draw_info_format (NDI_UNIQUE, 0, op, "You find %s in the chest.", query_name (treas)); |
2111 | |
2111 | |
2112 | treas->x = op->x; |
2112 | treas->x = op->x; |
2113 | treas->y = op->y; |
2113 | treas->y = op->y; |
2114 | treas = insert_ob_in_map (treas, op->map, op, INS_BELOW_ORIGINATOR); |
2114 | treas = insert_ob_in_map (treas, op->map, op, INS_BELOW_ORIGINATOR); |
… | |
… | |
2369 | } |
2369 | } |
2370 | #endif |
2370 | #endif |
2371 | INVOKE_PLAYER (LOGOUT, pl->contr); |
2371 | INVOKE_PLAYER (LOGOUT, pl->contr); |
2372 | /* Need to call terminate_all_pets() before we remove the player ob */ |
2372 | /* Need to call terminate_all_pets() before we remove the player ob */ |
2373 | terminate_all_pets (pl); |
2373 | terminate_all_pets (pl); |
2374 | remove_ob (pl); |
2374 | pl->remove (); |
2375 | pl->direction = 0; |
2375 | pl->direction = 0; |
2376 | new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, pl, "%s leaves the game.", &pl->name); |
2376 | new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, pl, "%s leaves the game.", &pl->name); |
2377 | |
2377 | |
2378 | /* update respawn position */ |
2378 | /* update respawn position */ |
2379 | strcpy (pl->contr->savebed_map, pl->map->path); |
2379 | strcpy (pl->contr->savebed_map, pl->map->path); |
… | |
… | |
2809 | if (op->type != PLAYER && QUERY_FLAG (op, FLAG_WAS_WIZ) && !QUERY_FLAG (pl, FLAG_WAS_WIZ)) |
2809 | if (op->type != PLAYER && QUERY_FLAG (op, FLAG_WAS_WIZ) && !QUERY_FLAG (pl, FLAG_WAS_WIZ)) |
2810 | { |
2810 | { |
2811 | play_sound_map (pl->map, pl->x, pl->y, SOUND_OB_EVAPORATE); |
2811 | play_sound_map (pl->map, pl->x, pl->y, SOUND_OB_EVAPORATE); |
2812 | new_draw_info (NDI_UNIQUE, 0, pl, "The object disappears in a puff " "of smoke!"); |
2812 | new_draw_info (NDI_UNIQUE, 0, pl, "The object disappears in a puff " "of smoke!"); |
2813 | new_draw_info (NDI_UNIQUE, 0, pl, "It must have been an illusion."); |
2813 | new_draw_info (NDI_UNIQUE, 0, pl, "It must have been an illusion."); |
2814 | remove_ob (op); |
2814 | op->remove (); |
2815 | free_object (op); |
2815 | op->destroy (0); |
2816 | return 1; |
2816 | return 1; |
2817 | } |
2817 | } |
2818 | |
2818 | |
2819 | pl->contr->last_used = op; |
2819 | pl->contr->last_used = op; |
2820 | pl->contr->last_used_id = op->count; |
2820 | pl->contr->last_used_id = op->count; |
… | |
… | |
2954 | SET_FLAG (tmp2, FLAG_INV_LOCKED); |
2954 | SET_FLAG (tmp2, FLAG_INV_LOCKED); |
2955 | |
2955 | |
2956 | if (who->type == PLAYER) |
2956 | if (who->type == PLAYER) |
2957 | esrv_del_item (who->contr, op->count); |
2957 | esrv_del_item (who->contr, op->count); |
2958 | |
2958 | |
2959 | remove_ob (op); |
2959 | op->remove (); |
2960 | free_object (op); |
2960 | op->destroy (0); |
2961 | insert_ob_in_ob (tmp2, who); |
2961 | insert_ob_in_ob (tmp2, who); |
2962 | fix_player (who); |
2962 | fix_player (who); |
2963 | if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)) |
2963 | if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)) |
2964 | { |
2964 | { |
2965 | if (who->type == PLAYER) |
2965 | if (who->type == PLAYER) |
… | |
… | |
3490 | |
3490 | |
3491 | /* Remove the old lantern */ |
3491 | /* Remove the old lantern */ |
3492 | if (who->type == PLAYER) |
3492 | if (who->type == PLAYER) |
3493 | esrv_del_item (who->contr, op->count); |
3493 | esrv_del_item (who->contr, op->count); |
3494 | |
3494 | |
3495 | remove_ob (op); |
3495 | op->remove (); |
3496 | free_object (op); |
3496 | op->destroy (0); |
3497 | |
3497 | |
3498 | /* insert the portion that was split off */ |
3498 | /* insert the portion that was split off */ |
3499 | if (tmp != NULL) |
3499 | if (tmp != NULL) |
3500 | { |
3500 | { |
3501 | (void) insert_ob_in_ob (tmp, who); |
3501 | (void) insert_ob_in_ob (tmp, who); |
… | |
… | |
3668 | op->stats.exp ? (int) op->stats.exp : MAX (op->map->difficulty, 5))) == NULL && --i); |
3668 | op->stats.exp ? (int) op->stats.exp : MAX (op->map->difficulty, 5))) == NULL && --i); |
3669 | if (tmp == NULL) |
3669 | if (tmp == NULL) |
3670 | return 0; |
3670 | return 0; |
3671 | if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) |
3671 | if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) |
3672 | { |
3672 | { |
3673 | free_object (tmp); |
3673 | tmp->destroy (0); |
3674 | tmp = NULL; |
3674 | tmp = NULL; |
3675 | } |
3675 | } |
3676 | } |
3676 | } |
3677 | while (!tmp); |
3677 | while (!tmp); |
3678 | tmp->x = op->x; |
3678 | tmp->x = op->x; |
… | |
… | |
3696 | * that is put inside other objects. |
3696 | * that is put inside other objects. |
3697 | */ |
3697 | */ |
3698 | for (tmp = op->inv; tmp; tmp = tmp2) |
3698 | for (tmp = op->inv; tmp; tmp = tmp2) |
3699 | { |
3699 | { |
3700 | tmp2 = tmp->below; |
3700 | tmp2 = tmp->below; |
3701 | remove_ob (tmp); |
3701 | tmp->remove (); |
3702 | if (op->env) |
3702 | if (op->env) |
3703 | insert_ob_in_ob (tmp, op->env); |
3703 | insert_ob_in_ob (tmp, op->env); |
3704 | else |
3704 | else |
3705 | free_object (tmp); |
3705 | tmp->destroy (0); |
3706 | } |
3706 | } |
3707 | remove_ob (op); |
3707 | op->remove (); |
3708 | free_object (op); |
3708 | op->destroy (0); |
3709 | break; |
3709 | break; |
3710 | } |
3710 | } |
3711 | return tmp ? 1 : 0; |
3711 | return tmp ? 1 : 0; |
3712 | } |
3712 | } |
3713 | |
3713 | |
… | |
… | |
3862 | change_abil (who, force); |
3862 | change_abil (who, force); |
3863 | insert_ob_in_ob (force, who); |
3863 | insert_ob_in_ob (force, who); |
3864 | } |
3864 | } |
3865 | else |
3865 | else |
3866 | { |
3866 | { |
3867 | free_object (force); |
3867 | force->destroy (0); |
3868 | } |
3868 | } |
3869 | |
3869 | |
3870 | /* check for hp, sp change */ |
3870 | /* check for hp, sp change */ |
3871 | if (food->stats.hp != 0) |
3871 | if (food->stats.hp != 0) |
3872 | { |
3872 | { |
… | |
… | |
3993 | object *tmp; |
3993 | object *tmp; |
3994 | |
3994 | |
3995 | new_draw_info (NDI_UNIQUE, 0, op, "Your spell warps!."); |
3995 | new_draw_info (NDI_UNIQUE, 0, op, "Your spell warps!."); |
3996 | tmp = get_archetype (SPELL_WONDER); |
3996 | tmp = get_archetype (SPELL_WONDER); |
3997 | cast_wonder (op, op, 0, tmp); |
3997 | cast_wonder (op, op, 0, tmp); |
3998 | free_object (tmp); |
3998 | tmp->destroy (0); |
3999 | } |
3999 | } |
4000 | else if (failure <= -15 && failure > -35) |
4000 | else if (failure <= -15 && failure > -35) |
4001 | { /* drain mana */ |
4001 | { /* drain mana */ |
4002 | new_draw_info (NDI_UNIQUE, 0, op, "Your mana is drained!."); |
4002 | new_draw_info (NDI_UNIQUE, 0, op, "Your mana is drained!."); |
4003 | op->stats.sp -= random_roll (0, power - 1, op, PREFER_LOW); |
4003 | op->stats.sp -= random_roll (0, power - 1, op, PREFER_LOW); |
… | |
… | |
4026 | object *tmp; |
4026 | object *tmp; |
4027 | |
4027 | |
4028 | tmp = get_archetype (LOOSE_MANA); |
4028 | tmp = get_archetype (LOOSE_MANA); |
4029 | cast_magic_storm (op, tmp, power); |
4029 | cast_magic_storm (op, tmp, power); |
4030 | new_draw_info (NDI_UNIQUE, 0, op, "You unlease uncontrolled mana!"); |
4030 | new_draw_info (NDI_UNIQUE, 0, op, "You unlease uncontrolled mana!"); |
4031 | free_object (tmp); |
4031 | tmp->destroy (0); |
4032 | } |
4032 | } |
4033 | } |
4033 | } |
4034 | } |
4034 | } |
4035 | |
4035 | |
4036 | void |
4036 | void |