… | |
… | |
1238 | |
1238 | |
1239 | object *top, *floor = NULL; |
1239 | object *top, *floor = NULL; |
1240 | |
1240 | |
1241 | op->remove (); |
1241 | op->remove (); |
1242 | |
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 | |
|
|
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 |
1255 | /* Better to catch this here, as otherwise the next use of this object |
1247 | /* Better to catch this here, as otherwise the next use of this object |
… | |
… | |
1421 | op->map->touch (); |
1413 | op->map->touch (); |
1422 | } |
1414 | } |
1423 | |
1415 | |
1424 | op->map->dirty = true; |
1416 | op->map->dirty = true; |
1425 | |
1417 | |
1426 | /* If we have a floor, we know the player, if any, will be above |
|
|
1427 | * it, so save a few ticks and start from there. |
|
|
1428 | */ |
|
|
1429 | if (!(flag & INS_MAP_LOAD)) |
1418 | if (!(flag & INS_MAP_LOAD)) |
1430 | if (object *pl = ms.player ()) |
1419 | if (object *pl = ms.player ()) |
1431 | pl->contr->ns->floorbox_update (); |
1420 | pl->contr->ns->floorbox_update (); |
1432 | |
1421 | |
1433 | /* If this object glows, it may affect lighting conditions that are |
1422 | /* If this object glows, it may affect lighting conditions that are |
… | |
… | |
2668 | old_container->flag [FLAG_APPLIED] = 0; |
2657 | old_container->flag [FLAG_APPLIED] = 0; |
2669 | container = 0; |
2658 | container = 0; |
2670 | |
2659 | |
2671 | esrv_update_item (UPD_FLAGS, this, old_container); |
2660 | esrv_update_item (UPD_FLAGS, this, old_container); |
2672 | new_draw_info_format (NDI_UNIQUE, 0, this, "You close %s.", query_name (old_container)); |
2661 | new_draw_info_format (NDI_UNIQUE, 0, this, "You close %s.", query_name (old_container)); |
|
|
2662 | play_sound (sound_find ("chest_close")); |
2673 | } |
2663 | } |
2674 | |
2664 | |
2675 | if (new_container) |
2665 | if (new_container) |
2676 | { |
2666 | { |
2677 | if (INVOKE_OBJECT (OPEN, new_container, ARG_OBJECT (this))) |
2667 | if (INVOKE_OBJECT (OPEN, new_container, ARG_OBJECT (this))) |
… | |
… | |
2693 | new_container->flag [FLAG_APPLIED] = 1; |
2683 | new_container->flag [FLAG_APPLIED] = 1; |
2694 | container = new_container; |
2684 | container = new_container; |
2695 | |
2685 | |
2696 | esrv_update_item (UPD_FLAGS, this, new_container); |
2686 | esrv_update_item (UPD_FLAGS, this, new_container); |
2697 | esrv_send_inventory (this, new_container); |
2687 | esrv_send_inventory (this, new_container); |
|
|
2688 | play_sound (sound_find ("chest_open")); |
2698 | } |
2689 | } |
2699 | } |
2690 | } |
2700 | |
2691 | |
2701 | object * |
2692 | object * |
2702 | object::force_find (const shstr name) |
2693 | object::force_find (const shstr name) |
… | |
… | |
2728 | force->flag [FLAG_APPLIED] = true; |
2719 | force->flag [FLAG_APPLIED] = true; |
2729 | |
2720 | |
2730 | insert (force); |
2721 | insert (force); |
2731 | } |
2722 | } |
2732 | |
2723 | |
|
|
2724 | void |
|
|
2725 | object::play_sound (faceidx sound) const |
|
|
2726 | { |
|
|
2727 | if (!sound) |
|
|
2728 | return; |
|
|
2729 | |
|
|
2730 | if (flag [FLAG_REMOVED]) |
|
|
2731 | return; |
|
|
2732 | |
|
|
2733 | if (env) |
|
|
2734 | { |
|
|
2735 | if (object *pl = in_player ()) |
|
|
2736 | pl->contr->play_sound (sound); |
|
|
2737 | } |
|
|
2738 | else |
|
|
2739 | map->play_sound (sound, x, y); |
|
|
2740 | } |
|
|
2741 | |