The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: makie on July 22, 2026, 10:51:44 AM

Title: narrow diagonals if season change
Post by: makie on July 22, 2026, 10:51:44 AM
narrow diagonals if season change
Ok it is only optical.

All fine
(https://makie.de/dsr.png)
winter is comming 
(https://makie.de/dw.png)
after rotate 4 times
(https://makie.de/dwr.png)
summer is coming
(https://makie.de/ds.png)
after rotate 4 time look first picture
Title: Re: narrow diagonals if season change
Post by: makie on July 22, 2026, 12:29:03 PM
drawing (building) tunnel 90km/h (pak128.german)
(https://makie.de/dt1.png)
after leaving the underground mod and reenter underground
(https://makie.de/dt2.png)
now it is fine
Title: Re: narrow diagonals if season change
Post by: victor_18993 on July 22, 2026, 01:11:21 PM
Found it - it is the season recalc picking the wrong image for a close diagonal.

A close diagonal is a four-way tile (ribi==all, diagonal_flag==0). calc_image() handles
it exclusively: its threeway branch gives it the close-diagonal image, or the matching
diagonal image when the pakset has no close-diagonal one. But check_season() (the fast
season-only recalc) is not exclusive:

  if( is_close_diagonal() ) { set close-diagonal image; }  // A
  if( is_diagonal() )      { ... }                          // B  <- separate if
  else if( threeway && !road ) { set switch image; }        // C
  else { flat }

For a close diagonal is_diagonal() is false, so it skips B and runs C, which overwrites
the image from A. On a season change the tile is redrawn as a straight four-way image
instead of a diagonal - the "narrow" look.

The A block was added in front of the old if(is_diagonal()) without turning it into
else if; calc_image() (same code) is already exclusive, only the season path was missed.

Reproduced on a flat map with the minimal close diagonal (a four-way centre whose four
neighbours are all bends). Comparing, on the same tile and season, the image the two
paths choose: calc_image=6625 (the diagonal), check_season=6610 (the flat four-way).
After the patch both give 6625.

Patch: in check_season() make the block an if/else if chain and mirror calc_image()'s
fallback. One file, upstream suite still passes. Applies on r12096.

I could not reproduce the "rotate 4 times" part directly - rotate90() toggles
close_diagonal_state without recalculating the image, so I think rotation just forces a
recalc that hits the same bug, but I did not prove that.
Title: Re: narrow diagonals if season change
Post by: prissi on July 22, 2026, 02:17:55 PM
Both should be fixed in r12098
Title: Re: narrow diagonals if season change
Post by: makie on July 23, 2026, 07:52:19 AM
I think its fixed.

Thanks very much.  :thumbsup:  :thumbsup:
Title: Re: narrow diagonals if season change
Post by: victor_18993 on July 23, 2026, 11:24:39 AM
Thanks for confirming it, and thanks to prissi for fixing both issues so quickly.
I checked the result as well and everything now looks correct on my side. Nice to see this one resolved. 🙂