Changeset - r25036:2e16369ceea0
[Not reviewed]
master
0 1 0
Jonathan G Rennison - 3 years ago 2021-02-27 19:24:22
j.g.rennison@gmail.com
Codechange: Add fast path to catenary drawing in MaskWireBits

MaskWireBits always returns its input unchanged if the input
has only 0 or 1 track bits set.
Having only 0 or 1 track bits sets (i.e. non junction tiles)
is by far the most common case.
Examining the state of neighbouring tiles and the subsequent
masking logic is relatively expensive and can be omitted in this case.
1 file changed with 3 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/elrail.cpp
Show inline comments
 
@@ -124,6 +124,9 @@ static TrackBits GetRailTrackBitsUnivers
 
 */
 
static TrackBits MaskWireBits(TileIndex t, TrackBits tracks)
 
{
 
	/* Single track bits are never masked out. */
 
	if (likely(HasAtMostOneBit(tracks))) return tracks;
 

	
 
	if (!IsPlainRailTile(t)) return tracks;
 

	
 
	TrackdirBits neighbour_tdb = TRACKDIR_BIT_NONE;
0 comments (0 inline, 0 general)