… | |
… | |
624 | return; |
624 | return; |
625 | } |
625 | } |
626 | |
626 | |
627 | mapspace &m = op->ms (); |
627 | mapspace &m = op->ms (); |
628 | |
628 | |
629 | if (m.flags_ & P_NEED_UPDATE) |
629 | if (!(m.flags_ & P_UPTODATE)) |
630 | /* nop */; |
630 | /* nop */; |
631 | else if (action == UP_OBJ_INSERT) |
631 | else if (action == UP_OBJ_INSERT) |
632 | { |
632 | { |
633 | // this is likely overkill, TODO: revisit (schmorp) |
633 | // this is likely overkill, TODO: revisit (schmorp) |
634 | if ((QUERY_FLAG (op, FLAG_BLOCKSVIEW) && !(m.flags_ & P_BLOCKSVIEW)) |
634 | if ((QUERY_FLAG (op, FLAG_BLOCKSVIEW) && !(m.flags_ & P_BLOCKSVIEW)) |
… | |
… | |
643 | /* This isn't perfect, but I don't expect a lot of objects to |
643 | /* This isn't perfect, but I don't expect a lot of objects to |
644 | * to have move_allow right now. |
644 | * to have move_allow right now. |
645 | */ |
645 | */ |
646 | || ((m.move_block | op->move_block) & ~op->move_allow) != m.move_block |
646 | || ((m.move_block | op->move_block) & ~op->move_allow) != m.move_block |
647 | || 1) // the above is not strong enough a test to skip updating. los maybe? TODO (Schmorp) |
647 | || 1) // the above is not strong enough a test to skip updating. los maybe? TODO (Schmorp) |
648 | m.flags_ = P_NEED_UPDATE; |
648 | m.flags_ = 0; |
649 | } |
649 | } |
650 | /* if the object is being removed, we can't make intelligent |
650 | /* if the object is being removed, we can't make intelligent |
651 | * decisions, because remove_ob can't really pass the object |
651 | * decisions, because remove_ob can't really pass the object |
652 | * that is being removed. |
652 | * that is being removed. |
653 | */ |
653 | */ |
654 | else if (action == UP_OBJ_CHANGE || action == UP_OBJ_REMOVE) |
654 | else if (action == UP_OBJ_CHANGE || action == UP_OBJ_REMOVE) |
655 | m.flags_ = P_NEED_UPDATE; |
655 | m.flags_ = 0; |
656 | else if (action == UP_OBJ_FACE) |
656 | else if (action == UP_OBJ_FACE) |
657 | /* Nothing to do for that case */ ; |
657 | /* Nothing to do for that case */ ; |
658 | else |
658 | else |
659 | LOG (llevError, "update_object called with invalid action: %d\n", action); |
659 | LOG (llevError, "update_object called with invalid action: %d\n", action); |
660 | |
660 | |
… | |
… | |
1072 | } |
1072 | } |
1073 | |
1073 | |
1074 | /* last == NULL if there are no objects on this space */ |
1074 | /* last == NULL if there are no objects on this space */ |
1075 | //TODO: this makes little sense, why only update the topmost object? |
1075 | //TODO: this makes little sense, why only update the topmost object? |
1076 | if (!last) |
1076 | if (!last) |
1077 | map->at (x, y).flags_ = P_NEED_UPDATE; |
1077 | map->at (x, y).flags_ = 0; |
1078 | else |
1078 | else |
1079 | update_object (last, UP_OBJ_REMOVE); |
1079 | update_object (last, UP_OBJ_REMOVE); |
1080 | |
1080 | |
1081 | if (flag [FLAG_BLOCKSVIEW] || glow_radius) |
1081 | if (flag [FLAG_BLOCKSVIEW] || glow_radius) |
1082 | update_all_los (map, x, y); |
1082 | update_all_los (map, x, y); |
… | |
… | |
1395 | * visible to others on this map. But update_all_los is really |
1395 | * visible to others on this map. But update_all_los is really |
1396 | * an inefficient way to do this, as it means los for all players |
1396 | * an inefficient way to do this, as it means los for all players |
1397 | * on the map will get recalculated. The players could very well |
1397 | * on the map will get recalculated. The players could very well |
1398 | * be far away from this change and not affected in any way - |
1398 | * be far away from this change and not affected in any way - |
1399 | * this should get redone to only look for players within range, |
1399 | * this should get redone to only look for players within range, |
1400 | * or just updating the P_NEED_UPDATE for spaces within this area |
1400 | * or just updating the P_UPTODATE for spaces within this area |
1401 | * of effect may be sufficient. |
1401 | * of effect may be sufficient. |
1402 | */ |
1402 | */ |
1403 | if (op->map->darkness && (op->glow_radius != 0)) |
1403 | if (op->map->darkness && (op->glow_radius != 0)) |
1404 | update_all_los (op->map, op->x, op->y); |
1404 | update_all_los (op->map, op->x, op->y); |
1405 | |
1405 | |