FS#1807 - Drawing Glitch with Trees on Road/Tram Crossing

Attached to Project: OpenTTD
Opened by Johannes E. Krause (Eddi) - Tuesday, 26 February 2008, 17:05 GMT
Last edited by Jean-Francois Claeys (Belugas) - Tuesday, 26 February 2008, 17:46 GMT
Type Bug
Category Vehicles → Trams
Status Closed
Assigned To No-one
Operating System All
Severity Very Low
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


when you have e.g. a tram in / direction and a road in crossing, then trees or lamps are placed on the tram rails
This task depends upon

Closed by  Jean-Francois Claeys (Belugas)
Wednesday, 27 February 2008, 15:35 GMT
Reason for closing:  Fixed
Additional comments about closing:  in r12290
thanks to you both
Comment by Johannes E. Krause (Eddi) - Tuesday, 26 February 2008, 17:37 GMT

next to Erlangen Nord, there are trees on the rails, and halfway towards Rüsselshorst, there are Lamps
Comment by Manuel Wolf (Roujin) - Tuesday, 26 February 2008, 19:12 GMT
I made a little patch that will look for road and tram bits instead of just road bits when drawing road details.
However, this will add lamps/trees also to tram-only tracks.

Comment by Manuel Wolf (Roujin) - Tuesday, 26 February 2008, 19:51 GMT
this second version does the same, except it skips drawing of road details if there are no road bits on the tile.
Comment by Jean-Francois Claeys (Belugas) - Wednesday, 27 February 2008, 04:09 GMT
Although i can confirm that your approach does work, i would have been more inclined to accept another one, which is actually to make the road side the one we want.
Alas, i've so far failed to make it so, even if the code seems to be a working one :(

Dunno. Just that it makes more sens to set proper surrounding to me.
Comment by Manuel Wolf (Roujin) - Wednesday, 27 February 2008, 11:49 GMT
I am against changing the roadside for two reasons:
1) what about this situation? (screenshot) With your approach, there would be no trees at all on that tile.
2) consistency. A four way road crossing also hasn't its roadside changed. The code looks up in _roadside_trees or _roadside_lamps which roaddetails have to be drawn for the given roadbits and that is "none" for a four way crossing. (as for no bits or one of the four bits).
Comment by Manuel Wolf (Roujin) - Wednesday, 27 February 2008, 12:14 GMT
Just now I looked at your approach.. that would kill any lamps/trees on the side of roads with a tramway, even if the tram follows the same path as the road.

Again, for me, roadside shouldn't be changed for something like this. If a road/tram bit is removed from such a tile (so that now trees/lamps should be drawn again), the game shouldn't have to look up again in which zone it is to know it needs roadside_trees or roadside_lamps. I think "roadside" means something like "if the environment is suitable, draw this and that". It's like this for four way road crossings like I posted above (roadside is e.g. trees, but lookup results in "nothing to be drawn"), and it should imo be like this for our problem here aswell.

Added version 3 of my fix, which also draws no roadside details if there are less than two road bits for consistency.