… | |
… | |
1237 | assert (!op->flag [FLAG_FREED]); |
1237 | assert (!op->flag [FLAG_FREED]); |
1238 | |
1238 | |
1239 | object *top, *floor = NULL; |
1239 | object *top, *floor = NULL; |
1240 | |
1240 | |
1241 | op->remove (); |
1241 | op->remove (); |
1242 | |
|
|
1243 | #if 0 |
|
|
1244 | if (!m->active != !op->active) |
|
|
1245 | if (m->active) |
|
|
1246 | op->activate_recursive (); |
|
|
1247 | else |
|
|
1248 | op->deactivate_recursive (); |
|
|
1249 | #endif |
|
|
1250 | |
1242 | |
1251 | if (out_of_map (m, op->x, op->y)) |
1243 | if (out_of_map (m, op->x, op->y)) |
1252 | { |
1244 | { |
1253 | LOG (llevError, "Trying to insert object outside the map.\n%s\n", op->debug_desc ()); |
1245 | LOG (llevError, "Trying to insert object outside the map.\n%s\n", op->debug_desc ()); |
1254 | #ifdef MANY_CORES |
1246 | #ifdef MANY_CORES |
… | |
… | |
2668 | old_container->flag [FLAG_APPLIED] = 0; |
2660 | old_container->flag [FLAG_APPLIED] = 0; |
2669 | container = 0; |
2661 | container = 0; |
2670 | |
2662 | |
2671 | esrv_update_item (UPD_FLAGS, this, old_container); |
2663 | esrv_update_item (UPD_FLAGS, this, old_container); |
2672 | new_draw_info_format (NDI_UNIQUE, 0, this, "You close %s.", query_name (old_container)); |
2664 | new_draw_info_format (NDI_UNIQUE, 0, this, "You close %s.", query_name (old_container)); |
|
|
2665 | play_sound (sound_find ("chest_close")); |
2673 | } |
2666 | } |
2674 | |
2667 | |
2675 | if (new_container) |
2668 | if (new_container) |
2676 | { |
2669 | { |
2677 | if (INVOKE_OBJECT (OPEN, new_container, ARG_OBJECT (this))) |
2670 | if (INVOKE_OBJECT (OPEN, new_container, ARG_OBJECT (this))) |
… | |
… | |
2693 | new_container->flag [FLAG_APPLIED] = 1; |
2686 | new_container->flag [FLAG_APPLIED] = 1; |
2694 | container = new_container; |
2687 | container = new_container; |
2695 | |
2688 | |
2696 | esrv_update_item (UPD_FLAGS, this, new_container); |
2689 | esrv_update_item (UPD_FLAGS, this, new_container); |
2697 | esrv_send_inventory (this, new_container); |
2690 | esrv_send_inventory (this, new_container); |
|
|
2691 | play_sound (sound_find ("chest_open")); |
2698 | } |
2692 | } |
2699 | } |
2693 | } |
2700 | |
2694 | |
2701 | object * |
2695 | object * |
2702 | object::force_find (const shstr name) |
2696 | object::force_find (const shstr name) |
… | |
… | |
2728 | force->flag [FLAG_APPLIED] = true; |
2722 | force->flag [FLAG_APPLIED] = true; |
2729 | |
2723 | |
2730 | insert (force); |
2724 | insert (force); |
2731 | } |
2725 | } |
2732 | |
2726 | |
|
|
2727 | void |
|
|
2728 | object::play_sound (faceidx sound) const |
|
|
2729 | { |
|
|
2730 | if (!sound) |
|
|
2731 | return; |
|
|
2732 | |
|
|
2733 | if (flag [FLAG_REMOVED]) |
|
|
2734 | return; |
|
|
2735 | |
|
|
2736 | if (env) |
|
|
2737 | { |
|
|
2738 | if (object *pl = in_player ()) |
|
|
2739 | pl->contr->play_sound (sound); |
|
|
2740 | } |
|
|
2741 | else |
|
|
2742 | map->play_sound (sound, x, y); |
|
|
2743 | } |
|
|
2744 | |