The bug was described here:
https://openxcom.org/forum/index.php/topic,10967.msg157865.html#msg157865Suggested fix was on the very next comment.
When you're targeting a unit, which stands on a high terrain level, sometimes you get target voxel on the upper tile.
Tile *t = ... target->toTile() gives a pointer to that upper tile
getOverlappingUnit() gives a pointer to the unit which "pokes" to the upper tile
but then
hasLOS = ... visible( bu, t ) uses that old upper tile, doesn't find a unit in it and returns false, thus incorrectly applying noLOSAccuracyPenalty.
Suggested solutions: either locally redefine Tile *t from found unit inside
if (targetUnit) { ... } block, or change
tile->getUnit() to
tile->getOverlappingUnit() inside
TileEngine::visible()Savefile (XPZ) with the issue is attached here:
https://openxcom.org/forum/index.php/topic,10967.msg157827.html#msg157827