The International Simutrans Forum

 

Author Topic: [BUG] The built in date of the factory info dialog is incorrect  (Read 487 times)

0 Members and 1 Guest are viewing this topic.

Offline Ranran

  • Devotee
  • *
  • Posts: 1151
  • Languages: ja
Built in date on the factory information does not seem to display the correct date.

I think it will be reset when the game is reloaded.
For example, in Bridgewater-Brunel server, most of the factories were built in 1750, but all show February 1751.



Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 20194
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: [BUG] The built in date of the factory info dialog is incorrect
« Reply #1 on: May 17, 2020, 11:34:02 AM »
I wonder whether these data are actually stored for industries? Perhaps that is why Standard does not have this feature. It may be best for the person who added the "Built in:" text to look into solving this one. It may need an update to the load/save code.

Offline Ranran

  • Devotee
  • *
  • Posts: 1151
  • Languages: ja
Re: [BUG] The built in date of the factory info dialog is incorrect
« Reply #2 on: May 18, 2020, 09:14:17 AM »
I wonder whether these data are actually stored for industries?
The factory doesn't seem to have the purchase_time initialized. Each client has a unique construction date, which does not seem to differ from factory to factory.
Try building a factory with the build industry tool. You will find that it has a common date with other factories, not the current date.


EDIT:
I made a change that just commented out it in another patch.
Bring it back if someone make a change that records built in date to the factory.
« Last Edit: May 18, 2020, 10:10:01 AM by Ranran »

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 20194
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: [BUG] The built in date of the factory info dialog is incorrect
« Reply #3 on: May 18, 2020, 11:08:19 AM »
Thank you for this. You refer to the value being uninitialised; may I ask where in the code that you found this? It may be fairly straightforward to modify this to save the value once its place in the code has been tracked down.

Offline Ranran

  • Devotee
  • *
  • Posts: 1151
  • Languages: ja
Re: [BUG] The built in date of the factory info dialog is incorrect
« Reply #4 on: May 18, 2020, 11:24:31 AM »
Code: [Select]
/**
* Construction began at this tick. "Pit" under-construction graphics handled by sync_step()
* @author Hj. Malthaner
*/
sint64 purchase_time;
I don't think the factory makes this correct value change.

Offline wlindley

  • Devotee
  • *
  • Posts: 1026
    • Hacking for fun and profit since 1977
  • Languages: EN, DE
Re: [BUG] The built in date of the factory info dialog is incorrect
« Reply #5 on: May 18, 2020, 02:48:43 PM »
The error occurs during a save/load process.

I submitted a pull request for this which is not yet approved. As per my follow-up comment, I see no reason to change the save-file version because difference in meaning of "purchase time" as previously saved is negligible compared to the updated one, and there would be no real point in changing the read-saved-file code to try and adjust for any difference. 
I believe needlessly complicating the version-dependence of the save/load code would be pointless.  If I were to modify that code, I would like to greatly streamline and crash-proof the load code by a more resilient format.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 20194
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: [BUG] The built in date of the factory info dialog is incorrect
« Reply #6 on: June 03, 2020, 01:04:10 PM »
My apologies: I realise that I had forgotten about this. Now incorporated. Thank you.

Offline Ranran

  • Devotee
  • *
  • Posts: 1151
  • Languages: ja
Re: [BUG] The built in date of the factory info dialog is incorrect
« Reply #7 on: July 11, 2020, 12:39:34 PM »
My apologies: I realise that I had forgotten about this. Now incorporated.
It seems that this issue is still unresolved.