The International Simutrans Forum

 

Author Topic: [BUG] bridgeheads can start in illegal locations  (Read 253 times)

0 Members and 1 Guest are viewing this topic.

Offline Freahk

  • Devotee
  • *
  • Posts: 1172
  • Languages: DE, EN
[BUG] bridgeheads can start in illegal locations
« on: July 28, 2020, 01:11:16 PM »
What happened?
On Bridgewater, a town forcefully built a bridge in a very strange way, causing a jam on Freddys railway line.

It is generally possible to force-build (ctrl-drag) a bridge to end on a through way.
This in independant of the involved waytype as long as both involved types are either the same or there is a level crossing defined in between those types.
Such bridges do not only look ugly, but those will also cut the route of the trough way, as just happened on bridgewater.

Another issue with this, I was not able to reproduce is a crash that can be caused by the construction of such bridges.
While building the crash setup, the game crashed twice, but I was not able to see the exact error message (the window closes immediately after showing it) nor was i able to get this reproduced.
I wll add instructions once I am able to reproduce the crash.

How to reproduce?
See the attached save, I have built any combination I could think of.
You can build any of these by
1. building the way on the ground
2. ctrl-dragging a bridge from a spare tile straight onto a flat way on the ground.

Thanks to Freddy, who noticed this behavior was not specific to towns constructing roads, but general to road construction. This made it much easier to provide a reproduction case.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 19975
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: [BUG] bridgeheads can start in illegal locations
« Reply #1 on: July 29, 2020, 01:10:56 PM »
Thank you for the report. The bridge building code is largely unchanged from Standard - does anyone know whether this issue is unique to Extended or whether it can be reproduced in Standard?

Offline kierongreen

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 2344
Re: [BUG] bridgeheads can start in illegal locations
« Reply #2 on: July 29, 2020, 01:39:43 PM »
Thank you for the report. The bridge building code is largely unchanged from Standard - does anyone know whether this issue is unique to Extended or whether it can be reproduced in Standard?
I can't seem to reproduce this in Standard

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 19975
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: [BUG] bridgeheads can start in illegal locations
« Reply #3 on: July 29, 2020, 01:43:22 PM »
I can't seem to reproduce this in Standard

Thank you for confirming.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 19975
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: [BUG] bridgeheads can start in illegal locations
« Reply #4 on: July 29, 2020, 06:08:19 PM »
I believe that I have now fixed this: this was very complex, and appears to arise in code from Standard: I was unable to find any divergence from Standard in the code in which this occurs.

Standard may well also suffer a crash, which I also fixed, when a three tile bridge was built with its far end immediately adjacent to a perpendicular way for which no crossing with the bridge's way was defined in the pakset.

Offline kierongreen

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 2344
Re: [BUG] bridgeheads can start in illegal locations
« Reply #5 on: July 29, 2020, 08:06:45 PM »
Have had a quick look at the fixes and I would be a bit wary of these - it seems like they might point to an underlying issue in the code elsewhere that differs from Standard and this could be leading to as yet unnoticed errors elsewhere in Extended. I'm suspecting that because Standard (and Extended) have managed so long without the checks in a section of code that goes back probably a decade. Also keeping code like this the same helps in keeping the versions as in sync with each other as possible.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 19975
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: [BUG] bridgeheads can start in illegal locations
« Reply #6 on: July 29, 2020, 08:20:16 PM »
Have had a quick look at the fixes and I would be a bit wary of these - it seems like they might point to an underlying issue in the code elsewhere that differs from Standard and this could be leading to as yet unnoticed errors elsewhere in Extended. I'm suspecting that because Standard (and Extended) have managed so long without the checks in a section of code that goes back probably a decade. Also keeping code like this the same helps in keeping the versions as in sync with each other as possible.

I am afraid that I am at a loss as to what the relevant difference between the codebases is here; you may also want to check the specific case to which I refer above to see whether this does provoke a crash in Standard.

Offline kierongreen

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 2344
Re: [BUG] bridgeheads can start in illegal locations
« Reply #7 on: July 29, 2020, 08:37:56 PM »
I am afraid that I am at a loss as to what the relevant difference between the codebases is here; you may also want to check the specific case to which I refer above to see whether this does provoke a crash in Standard.
I have without success in creating a crash in Standard unfortunately (or possibly fortunately)! Have tried to trace it a little in Extended but likewise can’t see the obvious cause.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 19975
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: [BUG] bridgeheads can start in illegal locations
« Reply #8 on: July 29, 2020, 08:40:01 PM »
I have without success in creating a crash in Standard unfortunately (or possibly fortunately)! Have tried to trace it a little in Extended but likewise can’t see the obvious cause.

Very odd. If anyone is ever able to find the divergence, it would be helpful to know where it arises.

I have to say, I was mystified by the intent of the code in Standard: that I modified: it appeared to be designed to allow a crossing to be built on a bridge ramp when the ramp was on a perpendicular way, which is obviously absurd; but there appear to be lines of code specifically and only for this purpose, which is part of what I commented out. I cannot understand why they were there.

Offline kierongreen

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 2344
Re: [BUG] bridgeheads can start in illegal locations
« Reply #9 on: July 30, 2020, 01:19:34 AM »
Bit of a prolonged process but currently seem to have identified that the error started occurring in August 2019 around time changes were happening to code to allow fords over some rivers but it's difficult to pinpoint exactly when
« Last Edit: July 30, 2020, 02:16:41 AM by kierongreen »

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 19975
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: [BUG] bridgeheads can start in illegal locations
« Reply #10 on: July 30, 2020, 10:32:13 AM »
Bit of a prolonged process but currently seem to have identified that the error started occurring in August 2019 around time changes were happening to code to allow fords over some rivers but it's difficult to pinpoint exactly when

Interesting, thank you. I was greatly hampered in my ability to look into this by not understanding the intent of the Standard code, as discussed in my previous post.

Offline kierongreen

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 2344
Re: [BUG] bridgeheads can start in illegal locations
« Reply #11 on: July 30, 2020, 10:36:04 AM »
Interesting, thank you. I was greatly hampered in my ability to look into this by not understanding the intent of the Standard code, as discussed in my previous post.
I'm still investigating (when work allows) as to exactly what change is that's causing this - haven't managed to track down the exact commit yet - that I'm learning how to use GIT on the go is probably slowing me down a bit too!