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.72 by elmex, Tue Dec 19 15:30:01 2006 UTC vs.
Revision 1.73 by root, Wed Dec 20 01:19:11 2006 UTC

1614 if (i > op->nrof) 1614 if (i > op->nrof)
1615 i = op->nrof; 1615 i = op->nrof;
1616 1616
1617 if (QUERY_FLAG (op, FLAG_REMOVED)) 1617 if (QUERY_FLAG (op, FLAG_REMOVED))
1618 op->nrof -= i; 1618 op->nrof -= i;
1619 else if (op->env != NULL) 1619 else if (op->env)
1620 { 1620 {
1621 /* is this object in the players inventory, or sub container 1621 /* is this object in the players inventory, or sub container
1622 * therein? 1622 * therein?
1623 */ 1623 */
1624 tmp = is_player_inv (op->env); 1624 tmp = is_player_inv (op->env);
1630 */ 1630 */
1631 if (!tmp) 1631 if (!tmp)
1632 { 1632 {
1633 for (pl = first_player; pl; pl = pl->next) 1633 for (pl = first_player; pl; pl = pl->next)
1634 if (pl->ob->container == op->env) 1634 if (pl->ob->container == op->env)
1635 {
1636 tmp = pl->ob;
1635 break; 1637 break;
1636 if (pl) 1638 }
1637 tmp = pl->ob;
1638 else
1639 tmp = NULL;
1640 } 1639 }
1641 1640
1642 if (i < op->nrof) 1641 if (i < op->nrof)
1643 { 1642 {
1644 sub_weight (op->env, op->weight * i); 1643 sub_weight (op->env, op->weight * i);
1645 op->nrof -= i; 1644 op->nrof -= i;
1646 if (tmp) 1645 if (tmp)
1647 {
1648 esrv_send_item (tmp, op); 1646 esrv_send_item (tmp, op);
1649 }
1650 } 1647 }
1651 else 1648 else
1652 { 1649 {
1653 op->remove (); 1650 op->remove ();
1654 op->nrof = 0; 1651 op->nrof = 0;
1655 if (tmp) 1652 if (tmp)
1656 {
1657 esrv_del_item (tmp->contr, op->count); 1653 esrv_del_item (tmp->contr, op->count);
1658 }
1659 } 1654 }
1660 } 1655 }
1661 else 1656 else
1662 { 1657 {
1663 object *above = op->above; 1658 object *above = op->above;
1669 op->remove (); 1664 op->remove ();
1670 op->nrof = 0; 1665 op->nrof = 0;
1671 } 1666 }
1672 1667
1673 /* Since we just removed op, op->above is null */ 1668 /* Since we just removed op, op->above is null */
1674 for (tmp = above; tmp != NULL; tmp = tmp->above) 1669 for (tmp = above; tmp; tmp = tmp->above)
1675 if (tmp->type == PLAYER) 1670 if (tmp->type == PLAYER)
1676 { 1671 {
1677 if (op->nrof) 1672 if (op->nrof)
1678 esrv_send_item (tmp, op); 1673 esrv_send_item (tmp, op);
1679 else 1674 else
1684 if (op->nrof) 1679 if (op->nrof)
1685 return op; 1680 return op;
1686 else 1681 else
1687 { 1682 {
1688 op->destroy (); 1683 op->destroy ();
1689 return NULL; 1684 return 0;
1690 } 1685 }
1691} 1686}
1692 1687
1693/* 1688/*
1694 * add_weight(object, weight) adds the specified weight to an object, 1689 * add_weight(object, weight) adds the specified weight to an object,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines