… | |
… | |
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 |
… | |
… | |
2611 | &name, |
2600 | &name, |
2612 | title ? "\",title:\"" : "", |
2601 | title ? "\",title:\"" : "", |
2613 | title ? (const char *)title : "", |
2602 | title ? (const char *)title : "", |
2614 | flag_desc (flagdesc, 512), type); |
2603 | flag_desc (flagdesc, 512), type); |
2615 | |
2604 | |
2616 | if (env) |
2605 | if (!this->flag[FLAG_REMOVED] && env) |
2617 | p += snprintf (p, 256, "(in %s)", env->debug_desc (info2)); |
2606 | p += snprintf (p, 256, "(in %s)", env->debug_desc (info2)); |
2618 | |
2607 | |
2619 | if (map) |
2608 | if (map) |
2620 | p += snprintf (p, 256, "(on %s@%d+%d)", &map->path, x, y); |
2609 | p += snprintf (p, 256, "(on %s@%d+%d)", &map->path, x, y); |
2621 | |
2610 | |
… | |
… | |
2730 | force->flag [FLAG_APPLIED] = true; |
2719 | force->flag [FLAG_APPLIED] = true; |
2731 | |
2720 | |
2732 | insert (force); |
2721 | insert (force); |
2733 | } |
2722 | } |
2734 | |
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 | |