News:

Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

[BUG] The built in date of the factory info dialog is incorrect

Started by Ranran, May 17, 2020, 09:35:34 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ranran

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.



jamespetts

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.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ranran

Quote from: jamespetts on May 17, 2020, 11:34:02 AMI 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.

jamespetts

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.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ranran


/**
* 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.

wlindley

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.

jamespetts

My apologies: I realise that I had forgotten about this. Now incorporated. Thank you.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ranran

Quote from: jamespetts on June 03, 2020, 01:04:10 PMMy apologies: I realise that I had forgotten about this. Now incorporated.
It seems that this issue is still unresolved.