Fix shadowcasting for weather with sight_penalty != 1.0 #72669
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
none
Purpose of change
Fix the comment #65205 (comment)
Fix #72508
Partially address #65205 ( there are still inconsistent shadowing in different weather conditions, but no more see through the wall )
If the span split is due to two transparent map tiles having different transparency ( like between indoor tiles and outdoor tiles ), those squares will be checked by both B and C spans. I could't say I understand shadowcasting very well, but I believe this behavior led to performance hit and weird shadowing in the steel mill.
Describe the solution
Like
skip_first_row
, add a variableskip_first_column
in structspan
, which indicates the span should skip the squares whoseleading_edge_minor
is the same as the span'sstart_minor
. The attribute is to be inherited by A, B and D spans ( those spans have the samestart_minor
as the span being split. ) As for C span, after being split, the attribute is rechecked and reapplied, to avoid inappropriately skipping squares.Describe alternatives you've considered
Testing
There is no perceived performance hit in the steel mill, even if I turned off compiler optimization for shadowcasting code.
There's more correct shadowing in the steel mill: ( compared with #65205 (comment) )
For #65205, inconsistency still exists, but the wall correctly blocks the terrain behind it.
Generally, this is not perfect nor final solution to artifacts in shadowcasting, but I believe I'm making it more correct.
Additional context