The International Simutrans Forum


Author Topic: [BUG] Plane runway selection off-by-one error.  (Read 1666 times)

0 Members and 1 Guest are viewing this topic.

Offline DrSuperGood

  • Dev Team
  • Devotee
  • *
  • Posts: 2833
  • Languages: EN
[BUG] Plane runway selection off-by-one error.
« on: June 28, 2019, 07:13:31 AM »
Aircraft have an off-by-one error when selecting which runway to take-off from.

The De Havilland Comet has a minimum runway length of 2012 meters. This translates into a runway requirement of at least 17 tiles. The airport the De Havilland Comet is trying to depart from has a selection of runway lengths available for use. For small and light aircraft there is the 2,000 meter (16 tile) runway. For medium sized aircraft there is the 3,000 meter (24 tile) runway. Finally for very large (at the current stage of the server) aircraft there is the 4,000 meter (32 tile) runway. Logically the De Havilland Comet should be landing and taking off from either the 3,000 meter or 4,000 meter runway as the 2,000 meter runway is 12 meters too short.

However the De Havilland Comet will actively route to and try to take-off from the 2,000 meter runway. This obviously fails when it gets to the runway as the runway is too short by 12 meters.

This points towards an off-by-one style rounding error when searching for runways to take-off from. The 2,012 meter requirement must be getting rounded down to 16 tile requirement instead of correctly up to 17 tiles causing it to route to the 16 tile runway instead of the 24 tile runway. When the plane gets to the runway it correctly tests if it is 17 tiles before starting a take-off and fails because the runway is only 16 tiles.
« Last Edit: July 03, 2019, 06:09:46 AM by DrSuperGood »

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 20194
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: [BUG] Plane runway selection off-by-one error.
« Reply #1 on: July 02, 2019, 10:20:55 PM »
Thank you for the report: I believe that I have now fixed this. I should be grateful if you could re-test with the next nightly build.