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.284 by root, Sat Jun 27 08:35:03 2009 UTC vs.
Revision 1.288 by root, Sat Oct 3 22:36:08 2009 UTC

328 // the player inventory itself is always visible 328 // the player inventory itself is always visible
329 if (env->is_player ()) 329 if (env->is_player ())
330 return env; 330 return env;
331 331
332 // else a player could have our env open 332 // else a player could have our env open
333 object *envest = env->outer_env (); 333 object *envest = env->outer_env_or_self ();
334 334
335 // the player itself is always on a map, so we will find him here 335 // the player itself is always on a map, so we will find him here
336 // even if our inv is in a player. 336 // even if our inv is in a player.
337 if (envest->is_on_map ()) 337 if (envest->is_on_map ())
338 if (object *pl = envest->ms ().player ()) 338 if (object *pl = envest->ms ().player ())
555 update_stats (); 555 update_stats ();
556 556
557 new_draw_info_format (NDI_UNIQUE, 0, this, 557 new_draw_info_format (NDI_UNIQUE, 0, this,
558 "You try to balance all your items at once, " 558 "You try to balance all your items at once, "
559 "but the %s is just too much for your body. " 559 "but the %s is just too much for your body. "
560 "[You need to unapply some items first.]", &ob->name); 560 "[You need to unapply some items first - use the 'body' command to see "
561 "how many items you cna wera on a specific body part.]", &ob->name);
561 return false; 562 return false;
562 } 563 }
563 564
564 //new_draw_info_format (NDI_UNIQUE, 0, this, "You switch to your %s.", &ob->name); 565 //new_draw_info_format (NDI_UNIQUE, 0, this, "You switch to your %s.", &ob->name);
565 } 566 }
831{ 832{
832 /* If already on active list, don't do anything */ 833 /* If already on active list, don't do anything */
833 if (active) 834 if (active)
834 return; 835 return;
835 836
836 if (has_active_speed () && flag [FLAG_FREED]) LOG (llevError | logBacktrace, "BUG: tried to activate freed object %s\n", debug_desc ());//D
837 if (has_active_speed () && flag [FLAG_DEBUG]) LOG (llevError | logBacktrace, "BUG: tried to activate DEBUG object %s\n", debug_desc ());//D temp
838
839 if (has_active_speed ()) 837 if (has_active_speed ())
838 {
839 if (flag [FLAG_FREED])
840 LOG (llevError | logBacktrace, "BUG: tried to activate freed object %s\n", debug_desc ());//D
841
840 actives.insert (this); 842 actives.insert (this);
843 }
841} 844}
842 845
843void 846void
844object::activate_recursive () 847object::activate_recursive ()
845{ 848{
1477 * blocked() and wall() work properly), and these flags are updated by 1480 * blocked() and wall() work properly), and these flags are updated by
1478 * update_object(). 1481 * update_object().
1479 */ 1482 */
1480 1483
1481 /* if this is not the head or flag has been passed, don't check walk on status */ 1484 /* if this is not the head or flag has been passed, don't check walk on status */
1482 if (!(flag & INS_NO_WALK_ON) && op->head_ () == op) 1485 if (!(flag & INS_NO_WALK_ON) && op->is_head ())
1483 { 1486 {
1484 if (check_move_on (op, originator)) 1487 if (check_move_on (op, originator))
1485 return 0; 1488 return 0;
1486 1489
1487 /* If we are a multi part object, lets work our way through the check 1490 /* If we are a multi part object, lets work our way through the check
1702 * on top. 1705 * on top.
1703 */ 1706 */
1704int 1707int
1705check_move_on (object *op, object *originator) 1708check_move_on (object *op, object *originator)
1706{ 1709{
1710 if (QUERY_FLAG (op, FLAG_NO_APPLY))
1711 return 0;
1712
1707 object *tmp; 1713 object *tmp;
1708 maptile *m = op->map; 1714 maptile *m = op->map;
1709 int x = op->x, y = op->y; 1715 int x = op->x, y = op->y;
1710 1716
1711 MoveType move_on, move_slow, move_block; 1717 mapspace &ms = m->at (x, y);
1712 1718
1713 if (QUERY_FLAG (op, FLAG_NO_APPLY)) 1719 ms.update ();
1714 return 0;
1715 1720
1716 move_on = GET_MAP_MOVE_ON (op->map, op->x, op->y); 1721 MoveType move_on = ms.move_on;
1717 move_slow = GET_MAP_MOVE_SLOW (op->map, op->x, op->y); 1722 MoveType move_slow = ms.move_slow;
1718 move_block = GET_MAP_MOVE_BLOCK (op->map, op->x, op->y); 1723 MoveType move_block = ms.move_block;
1719 1724
1720 /* if nothing on this space will slow op down or be applied, 1725 /* if nothing on this space will slow op down or be applied,
1721 * no need to do checking below. have to make sure move_type 1726 * no need to do checking below. have to make sure move_type
1722 * is set, as lots of objects don't have it set - we treat that 1727 * is set, as lots of objects don't have it set - we treat that
1723 * as walking. 1728 * as walking.
1734 return 0; 1739 return 0;
1735 1740
1736 /* The objects have to be checked from top to bottom. 1741 /* The objects have to be checked from top to bottom.
1737 * Hence, we first go to the top: 1742 * Hence, we first go to the top:
1738 */ 1743 */
1739 1744 for (object *next, *tmp = ms.top; tmp; tmp = next)
1740 for (tmp = op->ms ().bot; tmp && tmp->above; tmp = tmp->above)
1741 {
1742 /* Trim the search when we find the first other spell effect
1743 * this helps performance so that if a space has 50 spell objects,
1744 * we don't need to check all of them.
1745 */
1746 if ((tmp->move_type & MOVE_FLY_LOW) && QUERY_FLAG (tmp, FLAG_NO_PICK))
1747 break;
1748 } 1745 {
1746 next = tmp->below;
1749 1747
1750 for (; tmp; tmp = tmp->below)
1751 {
1752 if (tmp == op) 1748 if (tmp == op)
1753 continue; /* Can't apply yourself */ 1749 continue; /* Can't apply yourself */
1754 1750
1755 /* Check to see if one of the movement types should be slowed down. 1751 /* Check to see if one of the movement types should be slowed down.
1756 * Second check makes sure that the movement types not being slowed 1752 * Second check makes sure that the movement types not being slowed
1761 if (!QUERY_FLAG (op, FLAG_WIZPASS)) 1757 if (!QUERY_FLAG (op, FLAG_WIZPASS))
1762 { 1758 {
1763 if ((!op->move_type && tmp->move_slow & MOVE_WALK) || 1759 if ((!op->move_type && tmp->move_slow & MOVE_WALK) ||
1764 ((op->move_type & tmp->move_slow) && (op->move_type & ~tmp->move_slow & ~tmp->move_block) == 0)) 1760 ((op->move_type & tmp->move_slow) && (op->move_type & ~tmp->move_slow & ~tmp->move_block) == 0))
1765 { 1761 {
1766
1767 float
1768 diff = tmp->move_slow_penalty * fabs (op->speed); 1762 float diff = tmp->move_slow_penalty * fabs (op->speed);
1769 1763
1770 if (op->is_player ()) 1764 if (op->is_player ())
1771 if ((QUERY_FLAG (tmp, FLAG_IS_HILLY) && find_skill_by_number (op, SK_CLIMBING)) || 1765 if ((tmp->flag [FLAG_IS_HILLY ] && find_skill_by_number (op, SK_CLIMBING)) ||
1772 (QUERY_FLAG (tmp, FLAG_IS_WOODED) && find_skill_by_number (op, SK_WOODSMAN))) 1766 (tmp->flag [FLAG_IS_WOODED] && find_skill_by_number (op, SK_WOODSMAN)))
1773 diff /= 4.0; 1767 diff /= 4.0;
1774 1768
1775 op->speed_left -= diff; 1769 op->speed_left -= diff;
1776 } 1770 }
1777 } 1771 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines