… | |
… | |
1413 | op->map->touch (); |
1413 | op->map->touch (); |
1414 | } |
1414 | } |
1415 | |
1415 | |
1416 | op->map->dirty = true; |
1416 | op->map->dirty = true; |
1417 | |
1417 | |
1418 | /* If we have a floor, we know the player, if any, will be above |
|
|
1419 | * it, so save a few ticks and start from there. |
|
|
1420 | */ |
|
|
1421 | if (!(flag & INS_MAP_LOAD)) |
1418 | if (!(flag & INS_MAP_LOAD)) |
1422 | if (object *pl = ms.player ()) |
1419 | if (object *pl = ms.player ()) |
1423 | pl->contr->ns->floorbox_update (); |
1420 | pl->contr->ns->floorbox_update (); |
1424 | |
1421 | |
1425 | /* If this object glows, it may affect lighting conditions that are |
1422 | /* If this object glows, it may affect lighting conditions that are |
… | |
… | |
1666 | * be != op, if items are merged. -Tero |
1663 | * be != op, if items are merged. -Tero |
1667 | */ |
1664 | */ |
1668 | object * |
1665 | object * |
1669 | object::insert (object *op) |
1666 | object::insert (object *op) |
1670 | { |
1667 | { |
1671 | object *tmp, *otmp; |
|
|
1672 | |
|
|
1673 | if (!QUERY_FLAG (op, FLAG_REMOVED)) |
1668 | if (!QUERY_FLAG (op, FLAG_REMOVED)) |
1674 | op->remove (); |
1669 | op->remove (); |
1675 | |
1670 | |
1676 | if (op->more) |
1671 | if (op->more) |
1677 | { |
1672 | { |
… | |
… | |
1679 | return op; |
1674 | return op; |
1680 | } |
1675 | } |
1681 | |
1676 | |
1682 | CLEAR_FLAG (op, FLAG_OBJ_ORIGINAL); |
1677 | CLEAR_FLAG (op, FLAG_OBJ_ORIGINAL); |
1683 | CLEAR_FLAG (op, FLAG_REMOVED); |
1678 | CLEAR_FLAG (op, FLAG_REMOVED); |
|
|
1679 | |
1684 | if (op->nrof) |
1680 | if (op->nrof) |
1685 | { |
1681 | { |
1686 | for (tmp = inv; tmp != NULL; tmp = tmp->below) |
1682 | for (object *tmp = inv; tmp; tmp = tmp->below) |
1687 | if (object::can_merge (tmp, op)) |
1683 | if (object::can_merge (tmp, op)) |
1688 | { |
1684 | { |
1689 | /* return the original object and remove inserted object |
1685 | /* return the original object and remove inserted object |
1690 | (client needs the original object) */ |
1686 | (client needs the original object) */ |
1691 | tmp->nrof += op->nrof; |
1687 | tmp->nrof += op->nrof; |
… | |
… | |
1710 | add_weight (this, op->weight * op->nrof); |
1706 | add_weight (this, op->weight * op->nrof); |
1711 | } |
1707 | } |
1712 | else |
1708 | else |
1713 | add_weight (this, (op->weight + op->carrying)); |
1709 | add_weight (this, (op->weight + op->carrying)); |
1714 | |
1710 | |
1715 | otmp = this->in_player (); |
1711 | if (object *otmp = this->in_player ()) |
1716 | if (otmp && otmp->contr) |
|
|
1717 | if (!QUERY_FLAG (otmp, FLAG_NO_FIX_PLAYER)) |
1712 | if (otmp->contr && !QUERY_FLAG (otmp, FLAG_NO_FIX_PLAYER)) |
1718 | otmp->update_stats (); |
1713 | otmp->update_stats (); |
1719 | |
1714 | |
|
|
1715 | op->owner = 0; // its his/hers now. period. |
1720 | op->map = 0; |
1716 | op->map = 0; |
1721 | op->env = this; |
1717 | op->env = this; |
1722 | op->above = 0; |
1718 | op->above = 0; |
1723 | op->below = 0; |
1719 | op->below = 0; |
1724 | op->x = 0, op->y = 0; |
1720 | op->x = op->y = 0; |
1725 | |
1721 | |
1726 | /* reset the light list and los of the players on the map */ |
1722 | /* reset the light list and los of the players on the map */ |
1727 | if ((op->glow_radius != 0) && map) |
1723 | if (op->glow_radius && map) |
1728 | { |
1724 | { |
1729 | #ifdef DEBUG_LIGHTS |
1725 | #ifdef DEBUG_LIGHTS |
1730 | LOG (llevDebug, " insert_ob_in_ob(): got %s to insert in map/op\n", op->name); |
1726 | LOG (llevDebug, " insert_ob_in_ob(): got %s to insert in map/op\n", op->name); |
1731 | #endif /* DEBUG_LIGHTS */ |
1727 | #endif /* DEBUG_LIGHTS */ |
1732 | if (map->darkness) |
1728 | if (map->darkness) |
… | |
… | |
2603 | &name, |
2599 | &name, |
2604 | title ? "\",title:\"" : "", |
2600 | title ? "\",title:\"" : "", |
2605 | title ? (const char *)title : "", |
2601 | title ? (const char *)title : "", |
2606 | flag_desc (flagdesc, 512), type); |
2602 | flag_desc (flagdesc, 512), type); |
2607 | |
2603 | |
2608 | if (env) |
2604 | if (!this->flag[FLAG_REMOVED] && env) |
2609 | p += snprintf (p, 256, "(in %s)", env->debug_desc (info2)); |
2605 | p += snprintf (p, 256, "(in %s)", env->debug_desc (info2)); |
2610 | |
2606 | |
2611 | if (map) |
2607 | if (map) |
2612 | p += snprintf (p, 256, "(on %s@%d+%d)", &map->path, x, y); |
2608 | p += snprintf (p, 256, "(on %s@%d+%d)", &map->path, x, y); |
2613 | |
2609 | |