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.286 by root, Wed Sep 2 16:54:20 2009 UTC vs.
Revision 1.289 by root, Sun Oct 11 05:31:54 2009 UTC

431 object_freezer freezer; 431 object_freezer freezer;
432 op->write (freezer); 432 op->write (freezer);
433 return freezer.as_string (); 433 return freezer.as_string ();
434} 434}
435 435
436char *
437object::as_string ()
438{
439 return dump_object (this);
440}
441
436/* 442/*
437 * get_nearest_part(multi-object, object 2) returns the part of the 443 * get_nearest_part(multi-object, object 2) returns the part of the
438 * multi-object 1 which is closest to the second object. 444 * multi-object 1 which is closest to the second object.
439 * If it's not a multi-object, it is returned. 445 * If it's not a multi-object, it is returned.
440 */ 446 */
555 update_stats (); 561 update_stats ();
556 562
557 new_draw_info_format (NDI_UNIQUE, 0, this, 563 new_draw_info_format (NDI_UNIQUE, 0, this,
558 "You try to balance all your items at once, " 564 "You try to balance all your items at once, "
559 "but the %s is just too much for your body. " 565 "but the %s is just too much for your body. "
560 "[You need to unapply some items first.]", &ob->name); 566 "[You need to unapply some items first - use the 'body' command to see "
567 "how many items you cna wera on a specific body part.]", &ob->name);
561 return false; 568 return false;
562 } 569 }
563 570
564 //new_draw_info_format (NDI_UNIQUE, 0, this, "You switch to your %s.", &ob->name); 571 //new_draw_info_format (NDI_UNIQUE, 0, this, "You switch to your %s.", &ob->name);
565 } 572 }
1479 * blocked() and wall() work properly), and these flags are updated by 1486 * blocked() and wall() work properly), and these flags are updated by
1480 * update_object(). 1487 * update_object().
1481 */ 1488 */
1482 1489
1483 /* if this is not the head or flag has been passed, don't check walk on status */ 1490 /* if this is not the head or flag has been passed, don't check walk on status */
1484 if (!(flag & INS_NO_WALK_ON) && op->head_ () == op) 1491 if (!(flag & INS_NO_WALK_ON) && op->is_head ())
1485 { 1492 {
1486 if (check_move_on (op, originator)) 1493 if (check_move_on (op, originator))
1487 return 0; 1494 return 0;
1488 1495
1489 /* If we are a multi part object, lets work our way through the check 1496 /* If we are a multi part object, lets work our way through the check
1704 * on top. 1711 * on top.
1705 */ 1712 */
1706int 1713int
1707check_move_on (object *op, object *originator) 1714check_move_on (object *op, object *originator)
1708{ 1715{
1716 if (QUERY_FLAG (op, FLAG_NO_APPLY))
1717 return 0;
1718
1709 object *tmp; 1719 object *tmp;
1710 maptile *m = op->map; 1720 maptile *m = op->map;
1711 int x = op->x, y = op->y; 1721 int x = op->x, y = op->y;
1712 1722
1713 MoveType move_on, move_slow, move_block; 1723 mapspace &ms = m->at (x, y);
1714 1724
1715 if (QUERY_FLAG (op, FLAG_NO_APPLY)) 1725 ms.update ();
1716 return 0;
1717 1726
1718 move_on = GET_MAP_MOVE_ON (op->map, op->x, op->y); 1727 MoveType move_on = ms.move_on;
1719 move_slow = GET_MAP_MOVE_SLOW (op->map, op->x, op->y); 1728 MoveType move_slow = ms.move_slow;
1720 move_block = GET_MAP_MOVE_BLOCK (op->map, op->x, op->y); 1729 MoveType move_block = ms.move_block;
1721 1730
1722 /* if nothing on this space will slow op down or be applied, 1731 /* if nothing on this space will slow op down or be applied,
1723 * no need to do checking below. have to make sure move_type 1732 * no need to do checking below. have to make sure move_type
1724 * is set, as lots of objects don't have it set - we treat that 1733 * is set, as lots of objects don't have it set - we treat that
1725 * as walking. 1734 * as walking.
1736 return 0; 1745 return 0;
1737 1746
1738 /* The objects have to be checked from top to bottom. 1747 /* The objects have to be checked from top to bottom.
1739 * Hence, we first go to the top: 1748 * Hence, we first go to the top:
1740 */ 1749 */
1741 1750 for (object *next, *tmp = ms.top; tmp; tmp = next)
1742 for (tmp = op->ms ().bot; tmp && tmp->above; tmp = tmp->above)
1743 {
1744 /* Trim the search when we find the first other spell effect
1745 * this helps performance so that if a space has 50 spell objects,
1746 * we don't need to check all of them.
1747 */
1748 if ((tmp->move_type & MOVE_FLY_LOW) && QUERY_FLAG (tmp, FLAG_NO_PICK))
1749 break;
1750 } 1751 {
1752 next = tmp->below;
1751 1753
1752 for (; tmp; tmp = tmp->below)
1753 {
1754 if (tmp == op) 1754 if (tmp == op)
1755 continue; /* Can't apply yourself */ 1755 continue; /* Can't apply yourself */
1756 1756
1757 /* Check to see if one of the movement types should be slowed down. 1757 /* Check to see if one of the movement types should be slowed down.
1758 * Second check makes sure that the movement types not being slowed 1758 * Second check makes sure that the movement types not being slowed
1763 if (!QUERY_FLAG (op, FLAG_WIZPASS)) 1763 if (!QUERY_FLAG (op, FLAG_WIZPASS))
1764 { 1764 {
1765 if ((!op->move_type && tmp->move_slow & MOVE_WALK) || 1765 if ((!op->move_type && tmp->move_slow & MOVE_WALK) ||
1766 ((op->move_type & tmp->move_slow) && (op->move_type & ~tmp->move_slow & ~tmp->move_block) == 0)) 1766 ((op->move_type & tmp->move_slow) && (op->move_type & ~tmp->move_slow & ~tmp->move_block) == 0))
1767 { 1767 {
1768
1769 float
1770 diff = tmp->move_slow_penalty * fabs (op->speed); 1768 float diff = tmp->move_slow_penalty * fabs (op->speed);
1771 1769
1772 if (op->is_player ()) 1770 if (op->is_player ())
1773 if ((QUERY_FLAG (tmp, FLAG_IS_HILLY) && find_skill_by_number (op, SK_CLIMBING)) || 1771 if ((tmp->flag [FLAG_IS_HILLY ] && find_skill_by_number (op, SK_CLIMBING)) ||
1774 (QUERY_FLAG (tmp, FLAG_IS_WOODED) && find_skill_by_number (op, SK_WOODSMAN))) 1772 (tmp->flag [FLAG_IS_WOODED] && find_skill_by_number (op, SK_WOODSMAN)))
1775 diff /= 4.0; 1773 diff /= 4.0;
1776 1774
1777 op->speed_left -= diff; 1775 op->speed_left -= diff;
1778 } 1776 }
1779 } 1777 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines