--- deliantra/server/common/object.C 2008/12/23 01:13:15 1.266 +++ deliantra/server/common/object.C 2008/12/27 02:31:19 1.270 @@ -325,7 +325,7 @@ if (env) { // the player inventory itself is always visible - if (env->type == PLAYER) + if (env->is_player ()) return env; // else a player could have our env open @@ -760,7 +760,7 @@ // this is likely overkill, TODO: revisit (schmorp) if ((QUERY_FLAG (op, FLAG_BLOCKSVIEW) && !(m.flags_ & P_BLOCKSVIEW)) || (QUERY_FLAG (op, FLAG_NO_MAGIC) && !(m.flags_ & P_NO_MAGIC)) - || (op->type == PLAYER && !(m.flags_ & P_PLAYER)) + || (op->is_player () && !(m.flags_ & P_PLAYER)) || (op->type == SAFE_GROUND && !(m.flags_ & P_SAFE)) || (QUERY_FLAG (op, FLAG_ALIVE) && !(m.flags_ & P_IS_ALIVE)) || (QUERY_FLAG (op, FLAG_DAMNED) && !(m.flags_ & P_NO_CLERIC)) @@ -1081,11 +1081,11 @@ * to save cpu time. */ if (pl) - if (pl->contr && !QUERY_FLAG (pl, FLAG_NO_FIX_PLAYER)) + if (pl->is_player () && (glow_radius || !QUERY_FLAG (pl, FLAG_NO_FIX_PLAYER))) { pl->update_stats (); - if (affects_los () && pl->is_on_map () && pl->map->darkness) + if (glow_radius && pl->is_on_map ()) update_all_los (pl->map, pl->x, pl->y); } } @@ -1096,8 +1096,10 @@ if (object *pl = ms.player ()) { - if (type == PLAYER) // this == pl(!) + if (is_player ()) { + ms.smell = pticks; // remember the smell of the player + // leaving a spot always closes any open container on the ground if (container && !container->env) // this causes spurious floorbox updates, but it ensures @@ -1167,7 +1169,7 @@ last = tmp; } - if (map->darkness && affects_los ()) + if (affects_los ()) update_all_los (map, x, y); } } @@ -1424,7 +1426,7 @@ } } - if (op->type == PLAYER) + if (op->is_player ()) { op->contr->do_los = 1; ++op->map->players; @@ -1449,7 +1451,7 @@ * or just updating the P_UPTODATE for spaces within this area * of effect may be sufficient. */ - if (op->affects_los () && op->map->darkness) + if (op->affects_los ()) { op->ms ().invalidate (); update_all_los (op->map, op->x, op->y); @@ -1658,12 +1660,12 @@ inserted: /* reset the light list and los of the players on the map */ - if (op->glow_radius && is_on_map () && map->darkness) + if (op->glow_radius && is_on_map ()) { update_stats (); update_all_los (map, x, y); } - else if (type == PLAYER && !flag [FLAG_NO_FIX_PLAYER]) + else if (is_player () && !flag [FLAG_NO_FIX_PLAYER]) // if this is a player's inventory, update stats update_stats (); @@ -1758,7 +1760,7 @@ float diff = tmp->move_slow_penalty * fabs (op->speed); - if (op->type == PLAYER) + if (op->is_player ()) if ((QUERY_FLAG (tmp, FLAG_IS_HILLY) && find_skill_by_number (op, SK_CLIMBING)) || (QUERY_FLAG (tmp, FLAG_IS_WOODED) && find_skill_by_number (op, SK_WOODSMAN))) diff /= 4.0; @@ -2094,7 +2096,7 @@ else if (mflags & P_IS_ALIVE) { for (tmp = ms.bot; tmp; tmp = tmp->above) - if ((tmp->flag [FLAG_MONSTER] || tmp->type == PLAYER) + if ((tmp->flag [FLAG_MONSTER] || tmp->is_player ()) && (tmp != exclude || (tmp->head_ () != tmp && tmp->head_ () != exclude))) break; @@ -2290,7 +2292,7 @@ { return /*QUERY_FLAG(who,FLAG_WIZ)|| */ (item->weight > 0 && !QUERY_FLAG (item, FLAG_NO_PICK) && - !QUERY_FLAG (item, FLAG_ALIVE) && !item->invisible && (who->type == PLAYER || item->weight < who->weight / 3)); + !QUERY_FLAG (item, FLAG_ALIVE) && !item->invisible && (who->is_player () || item->weight < who->weight / 3)); } /* @@ -2606,8 +2608,20 @@ object *force = force_find (shstr_noise_force); if (force) - force->speed = 1.f / 4; // patch old speed up + force->speed_left = -1.f; // patch old speed up else - force_add (shstr_noise_force, 4); + { + force = archetype::get (shstr_noise_force); + + force->slaying = shstr_noise_force; + force->stats.food = 1; + force->speed_left = -1.f; + + force->set_speed (1.f / 4.f); + force->flag [FLAG_IS_USED_UP] = true; + force->flag [FLAG_APPLIED] = true; + + insert (force); + } }