Skip to content

Commit

Permalink
Properly set trailing edge major of B span
Browse files Browse the repository at this point in the history
The B span isn't processed further for the current block, so it was
phasing through tiles on the next z-level without checking them.
  • Loading branch information
ifreund committed Jul 9, 2019
1 parent 0ae920b commit 4403e33
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/shadowcasting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ struct span {
template<typename T, bool( *is_transparent )( const T &, const T & ), T( *accumulate )( const T &, const T &, const int & )>
static void split_span( std::list<span<T>> &spans, typename std::list<span<T>>::iterator &this_span,
T &current_transparency, const T &new_transparency, const T &last_intensity,
const int distance, slope &new_start_minor,
const tripoint &delta, const int distance, slope &new_start_minor,
const slope &trailing_edge_major, const slope &leading_edge_major,
const slope &trailing_edge_minor, const slope &leading_edge_minor )
{
Expand Down Expand Up @@ -114,9 +114,10 @@ static void split_span( std::list<span<T>> &spans, typename std::list<span<T>>::

// Emit the B span if present, placing it before the current span in the list
if( trailing_edge_minor > this_span->start_minor ) {
const slope next_trailing_edge_major( ( delta.z + 1 ) * 2 - 1, delta.y * 2 + 1 );
spans.emplace( this_span,
std::max( this_span->start_major, trailing_edge_major ),
std::min( this_span->end_major, leading_edge_major ),
std::min( this_span->end_major, next_trailing_edge_major ),
this_span->start_minor, trailing_edge_minor,
next_cumulative_transparency );
}
Expand Down Expand Up @@ -298,7 +299,7 @@ void cast_horizontal_zlight_segment(
// Handle spliting the span into up to 4 separate spans
split_span<T, is_transparent, accumulate>( spans, this_span, current_transparency,
new_transparency, last_intensity,
distance, new_start_minor,
delta, distance, new_start_minor,
trailing_edge_major, leading_edge_major,
trailing_edge_minor, leading_edge_minor );
}
Expand Down Expand Up @@ -480,7 +481,7 @@ void cast_vertical_zlight_segment(
// Handle spliting the span into up to 4 separate spans
split_span<T, is_transparent, accumulate>( spans, this_span, current_transparency,
new_transparency, last_intensity,
distance, new_start_minor,
delta, distance, new_start_minor,
trailing_edge_major, leading_edge_major,
trailing_edge_minor, leading_edge_minor );
}
Expand Down

0 comments on commit 4403e33

Please sign in to comment.