The International Simutrans Forum

 

Author Topic: Track renewal info is perhaps not displayed correctly  (Read 395 times)

0 Members and 1 Guest are viewing this topic.

Offline Matthew

  • *
  • Posts: 99
  • Languages: EN, some ZH, DE & SQ
Track renewal info is perhaps not displayed correctly
« on: June 13, 2018, 08:43:42 AM »
Track renewal does not seem to be working correctly in the nightly from 12 June (#26ed33b).

Steps to reproduce:
1. Open the autosave provided.
2. Go to square (981,249) or thereabouts; anywhere on the main line heading away from Dolingborne Combined Farms Railway Station (Great Plains Railway) into the countryside will do.
3. The track is 70 lb/yard, and has been set to be renewed as 97.5 lb/yard for many years. It says that it was last renewed in December 1912, but it has not upgraded to 97.5 lb. Since says the condition is 19% or so, I do not think it has ever been renewed.

When I originally played through into 1913, the last track renewal date updated to January 1913 sometime that month, but the track remained as 70lb/yard and the condition remained about 15%. However, when I ran the autosave game provided on fast-forward until the beginning of January 1913 in order to check that this could be reproduced, it did not update to January 1913.

Hopefully, this is 'just' a bug with updating the GUI text, rather than the renewal logic.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18030
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Track renewal info is perhaps not displayed correctly
« Reply #1 on: June 13, 2018, 09:03:00 AM »
Thank you for the report. The problem seems to have been that a recent change incorrectly caused the data as to when a way was last renewed to be reset to the current month when a game was loaded. This would not affect when the ways were actually renewed, but historical data on renewal will have been lost. This will not affect gameplay beyond the loss of interesting information, however.

I have now pushed what I believe is a fix to this, which should be available in the next nightly build.

Offline Matthew

  • *
  • Posts: 99
  • Languages: EN, some ZH, DE & SQ
Re: Track renewal info is perhaps not displayed correctly
« Reply #2 on: June 13, 2018, 09:25:47 AM »
Thank you, James. If only more problems in life could be fixed with the same rapidity with which you squash Simutrans bugs!

Offline Matthew

  • *
  • Posts: 99
  • Languages: EN, some ZH, DE & SQ
Re: Track renewal info is perhaps not displayed correctly
« Reply #3 on: June 13, 2018, 10:53:09 AM »
Just looking at the commit, did you intend to put the fix inside this block?:

Code: [Select]
if(desc->is_mothballed())
I know nothing about C++, but I can't quite follow the logic of putting that in the mothballed section, especially as it's followed by another !from_saved_game check straight afterwards.


Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18030
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Track renewal info is perhaps not displayed correctly
« Reply #4 on: June 13, 2018, 09:43:57 PM »
This is correct, as, previously, the date of degradation was not recorded. However, by pointing this out, you reminded me that I also need to add the relevant line to the subsequent block of code, which I now have done - thank you for checking this.

Offline Matthew

  • *
  • Posts: 99
  • Languages: EN, some ZH, DE & SQ
Re: Track renewal info is perhaps not displayed correctly
« Reply #5 on: June 14, 2018, 03:30:27 AM »
Good thing you know what you're doing! And now even I can follow the logic.  :)