… | |
… | |
323 | { |
323 | { |
324 | // see if we are in a container of sorts |
324 | // see if we are in a container of sorts |
325 | if (env) |
325 | if (env) |
326 | { |
326 | { |
327 | // the player inventory itself is always visible |
327 | // the player inventory itself is always visible |
328 | if (env->type == PLAYER) |
328 | if (env->is_player ()) |
329 | return env; |
329 | return env; |
330 | |
330 | |
331 | // else a player could have our env open |
331 | // else a player could have our env open |
332 | object *envest = env->outer_env (); |
332 | object *envest = env->outer_env (); |
333 | |
333 | |
… | |
… | |
758 | else if (action == UP_OBJ_INSERT) |
758 | else if (action == UP_OBJ_INSERT) |
759 | { |
759 | { |
760 | // this is likely overkill, TODO: revisit (schmorp) |
760 | // this is likely overkill, TODO: revisit (schmorp) |
761 | if ((QUERY_FLAG (op, FLAG_BLOCKSVIEW) && !(m.flags_ & P_BLOCKSVIEW)) |
761 | if ((QUERY_FLAG (op, FLAG_BLOCKSVIEW) && !(m.flags_ & P_BLOCKSVIEW)) |
762 | || (QUERY_FLAG (op, FLAG_NO_MAGIC) && !(m.flags_ & P_NO_MAGIC)) |
762 | || (QUERY_FLAG (op, FLAG_NO_MAGIC) && !(m.flags_ & P_NO_MAGIC)) |
763 | || (op->type == PLAYER && !(m.flags_ & P_PLAYER)) |
763 | || (op->is_player () && !(m.flags_ & P_PLAYER)) |
764 | || (op->type == SAFE_GROUND && !(m.flags_ & P_SAFE)) |
764 | || (op->type == SAFE_GROUND && !(m.flags_ & P_SAFE)) |
765 | || (QUERY_FLAG (op, FLAG_ALIVE) && !(m.flags_ & P_IS_ALIVE)) |
765 | || (QUERY_FLAG (op, FLAG_ALIVE) && !(m.flags_ & P_IS_ALIVE)) |
766 | || (QUERY_FLAG (op, FLAG_DAMNED) && !(m.flags_ & P_NO_CLERIC)) |
766 | || (QUERY_FLAG (op, FLAG_DAMNED) && !(m.flags_ & P_NO_CLERIC)) |
767 | || (m.move_on | op->move_on ) != m.move_on |
767 | || (m.move_on | op->move_on ) != m.move_on |
768 | || (m.move_off | op->move_off ) != m.move_off |
768 | || (m.move_off | op->move_off ) != m.move_off |
… | |
… | |
1083 | if (pl) |
1083 | if (pl) |
1084 | if (pl->is_player () && (glow_radius || !QUERY_FLAG (pl, FLAG_NO_FIX_PLAYER))) |
1084 | if (pl->is_player () && (glow_radius || !QUERY_FLAG (pl, FLAG_NO_FIX_PLAYER))) |
1085 | { |
1085 | { |
1086 | pl->update_stats (); |
1086 | pl->update_stats (); |
1087 | |
1087 | |
1088 | if (glow_radius && pl->is_on_map () && pl->map->darklevel () > 0) |
1088 | if (glow_radius && pl->is_on_map ()) |
1089 | update_all_los (pl->map, pl->x, pl->y); |
1089 | update_all_los (pl->map, pl->x, pl->y); |
1090 | } |
1090 | } |
1091 | } |
1091 | } |
1092 | else if (map) |
1092 | else if (map) |
1093 | { |
1093 | { |
1094 | map->dirty = true; |
1094 | map->dirty = true; |
1095 | mapspace &ms = this->ms (); |
1095 | mapspace &ms = this->ms (); |
1096 | |
1096 | |
1097 | if (object *pl = ms.player ()) |
1097 | if (object *pl = ms.player ()) |
1098 | { |
1098 | { |
1099 | if (type == PLAYER) // this == pl(!) |
1099 | if (is_player ()) |
1100 | { |
1100 | { |
|
|
1101 | ms.smell = pticks; // remember the smell of the player |
|
|
1102 | |
1101 | // leaving a spot always closes any open container on the ground |
1103 | // leaving a spot always closes any open container on the ground |
1102 | if (container && !container->env) |
1104 | if (container && !container->env) |
1103 | // this causes spurious floorbox updates, but it ensures |
1105 | // this causes spurious floorbox updates, but it ensures |
1104 | // that the CLOSE event is being sent. |
1106 | // that the CLOSE event is being sent. |
1105 | close_container (); |
1107 | close_container (); |
… | |
… | |
1165 | } |
1167 | } |
1166 | |
1168 | |
1167 | last = tmp; |
1169 | last = tmp; |
1168 | } |
1170 | } |
1169 | |
1171 | |
1170 | if (affects_los () && map->darklevel () > 0) |
1172 | if (affects_los ()) |
1171 | update_all_los (map, x, y); |
1173 | update_all_los (map, x, y); |
1172 | } |
1174 | } |
1173 | } |
1175 | } |
1174 | |
1176 | |
1175 | /* |
1177 | /* |
… | |
… | |
1422 | op->below = top; |
1424 | op->below = top; |
1423 | *(op->above ? &op->above->below : &ms.top) = op; |
1425 | *(op->above ? &op->above->below : &ms.top) = op; |
1424 | } |
1426 | } |
1425 | } |
1427 | } |
1426 | |
1428 | |
1427 | if (op->type == PLAYER) |
1429 | if (op->is_player ()) |
1428 | { |
1430 | { |
1429 | op->contr->do_los = 1; |
1431 | op->contr->do_los = 1; |
1430 | ++op->map->players; |
1432 | ++op->map->players; |
1431 | op->map->touch (); |
1433 | op->map->touch (); |
1432 | } |
1434 | } |
… | |
… | |
1447 | * be far away from this change and not affected in any way - |
1449 | * be far away from this change and not affected in any way - |
1448 | * this should get redone to only look for players within range, |
1450 | * this should get redone to only look for players within range, |
1449 | * or just updating the P_UPTODATE for spaces within this area |
1451 | * or just updating the P_UPTODATE for spaces within this area |
1450 | * of effect may be sufficient. |
1452 | * of effect may be sufficient. |
1451 | */ |
1453 | */ |
1452 | if (op->affects_los () && op->map->darklevel () > 0) |
1454 | if (op->affects_los ()) |
1453 | { |
1455 | { |
1454 | op->ms ().invalidate (); |
1456 | op->ms ().invalidate (); |
1455 | update_all_los (op->map, op->x, op->y); |
1457 | update_all_los (op->map, op->x, op->y); |
1456 | } |
1458 | } |
1457 | |
1459 | |
… | |
… | |
1656 | |
1658 | |
1657 | adjust_weight (this, op->total_weight ()); |
1659 | adjust_weight (this, op->total_weight ()); |
1658 | |
1660 | |
1659 | inserted: |
1661 | inserted: |
1660 | /* reset the light list and los of the players on the map */ |
1662 | /* reset the light list and los of the players on the map */ |
1661 | if (op->glow_radius && is_on_map () && map->darklevel () > 0) |
1663 | if (op->glow_radius && is_on_map ()) |
1662 | { |
1664 | { |
1663 | update_stats (); |
1665 | update_stats (); |
1664 | update_all_los (map, x, y); |
1666 | update_all_los (map, x, y); |
1665 | } |
1667 | } |
1666 | else if (type == PLAYER && !flag [FLAG_NO_FIX_PLAYER]) |
1668 | else if (is_player () && !flag [FLAG_NO_FIX_PLAYER]) |
1667 | // if this is a player's inventory, update stats |
1669 | // if this is a player's inventory, update stats |
1668 | update_stats (); |
1670 | update_stats (); |
1669 | |
1671 | |
1670 | INVOKE_OBJECT (INSERT, this); |
1672 | INVOKE_OBJECT (INSERT, this); |
1671 | |
1673 | |
… | |
… | |
1756 | { |
1758 | { |
1757 | |
1759 | |
1758 | float |
1760 | float |
1759 | diff = tmp->move_slow_penalty * fabs (op->speed); |
1761 | diff = tmp->move_slow_penalty * fabs (op->speed); |
1760 | |
1762 | |
1761 | if (op->type == PLAYER) |
1763 | if (op->is_player ()) |
1762 | if ((QUERY_FLAG (tmp, FLAG_IS_HILLY) && find_skill_by_number (op, SK_CLIMBING)) || |
1764 | if ((QUERY_FLAG (tmp, FLAG_IS_HILLY) && find_skill_by_number (op, SK_CLIMBING)) || |
1763 | (QUERY_FLAG (tmp, FLAG_IS_WOODED) && find_skill_by_number (op, SK_WOODSMAN))) |
1765 | (QUERY_FLAG (tmp, FLAG_IS_WOODED) && find_skill_by_number (op, SK_WOODSMAN))) |
1764 | diff /= 4.0; |
1766 | diff /= 4.0; |
1765 | |
1767 | |
1766 | op->speed_left -= diff; |
1768 | op->speed_left -= diff; |
… | |
… | |
2092 | if ((move_type & blocked) == move_type) |
2094 | if ((move_type & blocked) == move_type) |
2093 | max = maxfree[i]; |
2095 | max = maxfree[i]; |
2094 | else if (mflags & P_IS_ALIVE) |
2096 | else if (mflags & P_IS_ALIVE) |
2095 | { |
2097 | { |
2096 | for (tmp = ms.bot; tmp; tmp = tmp->above) |
2098 | for (tmp = ms.bot; tmp; tmp = tmp->above) |
2097 | if ((tmp->flag [FLAG_MONSTER] || tmp->type == PLAYER) |
2099 | if ((tmp->flag [FLAG_MONSTER] || tmp->is_player ()) |
2098 | && (tmp != exclude || (tmp->head_ () != tmp && tmp->head_ () != exclude))) |
2100 | && (tmp != exclude || (tmp->head_ () != tmp && tmp->head_ () != exclude))) |
2099 | break; |
2101 | break; |
2100 | |
2102 | |
2101 | if (tmp) |
2103 | if (tmp) |
2102 | return freedir[i]; |
2104 | return freedir[i]; |
… | |
… | |
2288 | int |
2290 | int |
2289 | can_pick (const object *who, const object *item) |
2291 | can_pick (const object *who, const object *item) |
2290 | { |
2292 | { |
2291 | return /*QUERY_FLAG(who,FLAG_WIZ)|| */ |
2293 | return /*QUERY_FLAG(who,FLAG_WIZ)|| */ |
2292 | (item->weight > 0 && !QUERY_FLAG (item, FLAG_NO_PICK) && |
2294 | (item->weight > 0 && !QUERY_FLAG (item, FLAG_NO_PICK) && |
2293 | !QUERY_FLAG (item, FLAG_ALIVE) && !item->invisible && (who->type == PLAYER || item->weight < who->weight / 3)); |
2295 | !QUERY_FLAG (item, FLAG_ALIVE) && !item->invisible && (who->is_player () || item->weight < who->weight / 3)); |
2294 | } |
2296 | } |
2295 | |
2297 | |
2296 | /* |
2298 | /* |
2297 | * create clone from object to another |
2299 | * create clone from object to another |
2298 | */ |
2300 | */ |