ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/object.C
(Generate patch)

Comparing deliantra/server/common/object.C (file contents):
Revision 1.180 by root, Wed Aug 15 04:59:46 2007 UTC vs.
Revision 1.182 by root, Mon Aug 20 18:11:02 2007 UTC

1663 * be != op, if items are merged. -Tero 1663 * be != op, if items are merged. -Tero
1664 */ 1664 */
1665object * 1665object *
1666object::insert (object *op) 1666object::insert (object *op)
1667{ 1667{
1668 object *tmp, *otmp;
1669
1670 if (!QUERY_FLAG (op, FLAG_REMOVED)) 1668 if (!QUERY_FLAG (op, FLAG_REMOVED))
1671 op->remove (); 1669 op->remove ();
1672 1670
1673 if (op->more) 1671 if (op->more)
1674 { 1672 {
1676 return op; 1674 return op;
1677 } 1675 }
1678 1676
1679 CLEAR_FLAG (op, FLAG_OBJ_ORIGINAL); 1677 CLEAR_FLAG (op, FLAG_OBJ_ORIGINAL);
1680 CLEAR_FLAG (op, FLAG_REMOVED); 1678 CLEAR_FLAG (op, FLAG_REMOVED);
1679
1681 if (op->nrof) 1680 if (op->nrof)
1682 { 1681 {
1683 for (tmp = inv; tmp != NULL; tmp = tmp->below) 1682 for (object *tmp = inv; tmp; tmp = tmp->below)
1684 if (object::can_merge (tmp, op)) 1683 if (object::can_merge (tmp, op))
1685 { 1684 {
1686 /* return the original object and remove inserted object 1685 /* return the original object and remove inserted object
1687 (client needs the original object) */ 1686 (client needs the original object) */
1688 tmp->nrof += op->nrof; 1687 tmp->nrof += op->nrof;
1707 add_weight (this, op->weight * op->nrof); 1706 add_weight (this, op->weight * op->nrof);
1708 } 1707 }
1709 else 1708 else
1710 add_weight (this, (op->weight + op->carrying)); 1709 add_weight (this, (op->weight + op->carrying));
1711 1710
1712 otmp = this->in_player (); 1711 if (object *otmp = this->in_player ())
1713 if (otmp && otmp->contr)
1714 if (!QUERY_FLAG (otmp, FLAG_NO_FIX_PLAYER)) 1712 if (otmp->contr && !QUERY_FLAG (otmp, FLAG_NO_FIX_PLAYER))
1715 otmp->update_stats (); 1713 otmp->update_stats ();
1716 1714
1715 op->owner = 0; // its his/hers now. period.
1717 op->map = 0; 1716 op->map = 0;
1718 op->env = this; 1717 op->env = this;
1719 op->above = 0; 1718 op->above = 0;
1720 op->below = 0; 1719 op->below = 0;
1721 op->x = 0, op->y = 0; 1720 op->x = op->y = 0;
1722 1721
1723 /* 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 */
1724 if ((op->glow_radius != 0) && map) 1723 if (op->glow_radius && map)
1725 { 1724 {
1726#ifdef DEBUG_LIGHTS 1725#ifdef DEBUG_LIGHTS
1727 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);
1728#endif /* DEBUG_LIGHTS */ 1727#endif /* DEBUG_LIGHTS */
1729 if (map->darkness) 1728 if (map->darkness)
2600 &name, 2599 &name,
2601 title ? "\",title:\"" : "", 2600 title ? "\",title:\"" : "",
2602 title ? (const char *)title : "", 2601 title ? (const char *)title : "",
2603 flag_desc (flagdesc, 512), type); 2602 flag_desc (flagdesc, 512), type);
2604 2603
2605 if (env) 2604 if (!this->flag[FLAG_REMOVED] && env)
2606 p += snprintf (p, 256, "(in %s)", env->debug_desc (info2)); 2605 p += snprintf (p, 256, "(in %s)", env->debug_desc (info2));
2607 2606
2608 if (map) 2607 if (map)
2609 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);
2610 2609

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines