Fix: GetCurveSpeedLimit needs railtype from current tile #8466
Motivation / Problem
This is a fix to make railtype prop 11 work as described in the newgrf spec https://newgrf-specs.tt-wiki.net/wiki/Action0/Railtypes#Curve_Speed_advantage_multiplier_.2811.29
"This property sets the multiplier to the curve speed advantage which all trains running on this track type get."
GetCurveSpeedLimit was using the railtype from train prop 05, not the current railtype on the tile. Seems plausible that it was just missed when NewGRF railtypes were added.
I noticed this (some time ago) when I created a railtype grf setting a higher value for prop 11 and could see no difference in game.
Additionally for Jan/Feb 2021 there is a tt-forums contest running for 'make a High Speed grf' which motivated me to look into this again, as contestants may encounter this bug.
GetCurveSpeedLimit now checks current railtype on the tile.
Test grf and savegame attached. Behaves as expected in the test case.
I tried a test case where the railtype changes mid-curve. It's not in the savegame, but it does appear to work.
GetAccelerationType in train.h (railtype prop 15) may have the same issue, but the NewGRF spec is less definitive there and is likely to trigger a debate, so I would like to stick to just fixing prop 11 as a single issue.
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.
i haven't spent a great deal of time on looking at the implementation, but i support this change conceptually, as the spec pretty clearly state that this is what it meant.
i'm not taking any sides here, but if we are looking at possibly supporting stuff like "rack rail", or "cable car", this would need both the engine and the tracks to be providing the new acceleration model. although you could just tell people that non-rack rail engines should be defined as not powered on rack rails, then it would fall back to just the rails defining acceleration model.
Prop 15 is indeed a bit unclear. First of all, there is literally only one singular use of that in OTTD. If that prop is set to 2, "maglev" is assumed and the acceleration calculation will ignore rolling resistance.
Right now it functions more like an engine property. I don't know if it would be better to make it a true railtype property. I also wonder whether there is any railtype GRF at all that uses prop 15 purposefully and not just by accident.