The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: Spike on March 01, 2012, 02:23:11 PM

Title: Tree age problem when starting with year 1 in pak48.Excentrique
Post by: Spike on March 01, 2012, 02:23:11 PM
Simutrans 111.2.1 has a tree age problem when starting with year 1 in pak48.Excentrique

I'm somewhat certain that version 111.1 did not yet have this problem, but I haven't installed the old version again to test it - just my memory sais it worked before, so I might be wrong there.
Title: Re: Tree age problem when starting with year 1 in pak48.Excentrique
Post by: Dwachs on March 01, 2012, 03:53:26 PM
This is a tree from the generated map started at year 1?
Title: Re: Tree age problem when starting with year 1 in pak48.Excentrique
Post by: Spike on March 01, 2012, 09:42:13 PM
I think. I had just started the game, clicked "new map" and then was checking object descriptions. It's not the only tree that has this problem.

I tried to start pak64 at year 1 to see if it's a pak problem, but pak64 didn't let me to. It started at 1400 and at that point tree had a good age display.
Title: Re: Tree age problem when starting with year 1 in pak48.Excentrique
Post by: Fabio on March 01, 2012, 10:38:28 PM
Trees are created at different ages, IIRC. e.g. if I create a map in 2000 they are not all saplings. If the tree is 20 years old its birth year is 1980. But if year is 1 and year is uint, birth year is not -19 but e.g. 65308/12 =5442. Thus its age is 1   -5442=-5441
In other words I believe there is an overflow if the age is stored in month of birth uint 0    to 65535 and the tree created in year 1 is older than 1 year.
You could check this in code, though.
Title: Re: Tree age problem when starting with year 1 in pak48.Excentrique
Post by: prissi on March 01, 2012, 10:47:23 PM
fabio nailed it. We need to enforce have a lower limit on tree age then ...
Title: Re: Tree age problem when starting with year 1 in pak48.Excentrique
Post by: Dwachs on March 03, 2012, 10:43:19 AM
fixed r5472