The International Simutrans Forum

Development => Technical Documentation => Topic started by: Combuijs on November 19, 2012, 10:08:03 PM

Title: Maximum of build_time parameter
Post by: Combuijs on November 19, 2012, 10:08:03 PM
Can anybody tell me what the maximum build_time parameter is for city attractions?

For a city attraction I have specified a build_time of 723000. However in the game it is shown as 2104. As 723000 - 2104 = 720896 = 11 * 65536 (maxint for 16 bytes integers) I have the nagging suspicion the maximum build time is 65535.

If I look in the code however I see in gebaeude.h the parameter

uint32 insta_zeit

which is read/written in the rdwr function with

rdwr_long

which suggests to me that the maximum should be higher.

Can anyone shed a light on this?

Edit:

I found in haus_besch.h this line:

uint16 extra_data;      // bauzeit (inhabitants) for city attractions, waytype for depots, player level for headquarters

which indeed suggests that build_time is a uint16 when reading from and writing to a pak file. That is a pity as the other place suggests higher possible values.
Title: Re: Maximum of build_time parameter
Post by: Ters on November 20, 2012, 05:35:09 AM
build_time/extra_data isn't a time-value. As the comment indicates, it's the number of inhabitants a city must have to trigger the building of the attraction. insta_zeit on the other had, might be the date the actual building was built in a game. If so the fields you're comparing are like comparing apples and oranges.
Title: Re: Maximum of build_time parameter
Post by: VS on November 20, 2012, 09:15:46 AM
Sorry, but... did you actually read what Combuijs wrote? He's simply asking for more bits in besch for this parameter and understands what it is well enough :D
Title: Re: Maximum of build_time parameter
Post by: Combuijs on November 20, 2012, 09:48:01 AM
Hmm, Ters is right about insta_zeit. Scrolling around in gebaeude.cc it is clear that this property is not the build_time property, but related to showing the building as a construction place (the one with the bulldozer). So, I will have to delve deeper in the code where the build_time is hidden. Or maybe someone can tell me ...  8)

Edit:

OK, I dressed as a miner with a light on my helmet and sank into the Simutrans code. In simcity.cc check_bau_spezial is called whenever a city extends. It calls hausbauer.cc get_special which directly looks at the extra_data in haus_besch. So indeed, the maximum build_time is 65535. Back to the drawing board for my city attractions!

For the german-impaired:

hausbauer -> house builder
check_bau_special -> check special building
haus_besch -> house description
gebaeude -> buildings
insta_zeit -> time of instantation
Title: Re: Maximum of build_time parameter
Post by: prissi on November 20, 2012, 12:14:53 PM
Many other stuff assumes that the year and month never exceeds 65536 is still in the game, imho. So far only on player reached the limit when is was still 2730 and you had to start at 1930 and there was no fast forward. (Must have played day and night for a year or so.)
Title: Re: Maximum of build_time parameter
Post by: Combuijs on November 20, 2012, 12:19:16 PM
Yes, but the build_time is  the number of inhabitants of a city, which can and will easily be bigger than 65536. But after a city size of 65536 you will not be able to get new city attractions. Not a disaster of course, but a little bit strange.
Title: Re: Maximum of build_time parameter
Post by: Ters on November 20, 2012, 05:31:07 PM
Quote from: VS on November 20, 2012, 09:15:46 AM
Sorry, but... did you actually read what Combuijs wrote? He's simply asking for more bits in besch for this parameter and understands what it is well enough :D

I did. I was just pointing out that the number of bits in insta_zeit has nothing to do with how many bits build_time should have. (Though my post may be worded a bit strange since I misunderstood the post first time around, but I found it still valid, even if a bit verbose in the beginning.)
Title: Re: Maximum of build_time parameter
Post by: Fabio on November 20, 2012, 06:10:20 PM
Indeed 64k citizen is way too low a limit for attractions...
Title: Re: Maximum of build_time parameter
Post by: Combuijs on November 20, 2012, 06:47:15 PM
Quote from: Fabio on November 20, 2012, 06:10:20 PM
Indeed 64k citizen is way too low a limit for attractions...

Yes, I think so too. On the other hand, we have this limit since Simutrans started and I have never heard any complaints before.
Title: Re: Maximum of build_time parameter
Post by: Ters on November 20, 2012, 08:40:17 PM
When cities have become that big, I'm too busy with everything else to notice that attractions have stopped.
Title: Re: Maximum of build_time parameter
Post by: VS on November 20, 2012, 09:55:00 PM
Quote from: Ters on November 20, 2012, 05:31:07 PM
I did. I was just pointing out that the number of bits in insta_zeit has nothing to do with how many bits build_time should have.
Aaargh! Of course you are right. I think I can see a pattern... I should take a break or something :-/
Title: Re: Maximum of build_time parameter
Post by: sdog on November 20, 2012, 10:18:05 PM
Quote from: VS on November 20, 2012, 09:55:00 PM
Aaargh! Of course you are right. I think I can see a pattern... I should take a break or something :-/
Running about with a flamethrower...  what happened to you man! ;-)
Title: Re: Maximum of build_time parameter
Post by: z9999+ on November 24, 2012, 09:36:39 AM
We are waiting this 32bit support for 5 years. :)

Japanese townhall addon on japanese wiki was made in 2007.
It contains a townhall which will be build when reach 100,000 peoples, but not yet work as intended.
Title: Re: Maximum of build_time parameter
Post by: Dwachs on November 25, 2012, 01:40:15 PM
Quote from: z9999+ on November 24, 2012, 09:36:39 AM
We are waiting this 32bit support for 5 years. :)
The time is fulfilled. Waiting is over. Enjoy r6094.

Almost everything was there in the code, the build-time value was already written as being 32bit, however internally only 16bit variables were used.

Old addons have to be recompiled again (or hacked).
Title: Re: Maximum of build_time parameter
Post by: Combuijs on November 25, 2012, 02:13:21 PM
 :-*

Thank you very much for that!
Title: Re: Maximum of build_time parameter
Post by: Combuijs on January 05, 2013, 09:55:50 PM
I've tested this (finally...) in 112.1 . It does not seem to work however.

I have recompiled the whole pak with makeobj (version 55, the one linked in the download 112.1 topic). But in the "build attraction" dialog you will still find the truncated values (modulo 65536) and the attraction is built at that value.

I suspect the 55 version should be updated to a 56 version in order to have this functionality working. Am I right?
Title: Re: Maximum of build_time parameter
Post by: Ters on January 05, 2013, 10:39:26 PM
The change didn't affect the file format. My self-compiled makeobj reports that it's version 55 for 112.1.1 and a population trigger of 150000 was written correctly into the pak file for a city attraction. If something still truncates this value, it's the game itself, but I can't see anything wrong with the loading code either.

EDIT:
Just loaded this modified pak into the game. The correct number is shown in the curiosity builder window.
Title: Re: Maximum of build_time parameter
Post by: Combuijs on January 05, 2013, 11:21:34 PM
QuoteMy self-compiled makeobj ...

So that's the key! The makeobj.exe to download for windows from sourceforge is not the one belonging to 112.1 I guess. Could anyone change that?

I could of course build makeobj.exe myself, but will have to find out how. Will look into that on monday if I have time.

Edit: and by the way 112.1.1 is not an existing simutrans version...

Edit 2: My makeobj.exe states "Makeobj version 55 for Simutrans 112.0 and higher"
Title: Re: Maximum of build_time parameter
Post by: Ters on January 06, 2013, 08:56:53 AM
112.1.1 is the version number for the post-112.1 nightlies. You need version 112.1 of both Simutrans and makeobj, the latter of which doesn't appear to have been released. (It's possible that it hasn't been released, since it's version number wasn't bumped when makeobj was told not to truncate the extra field.)
Title: Re: Maximum of build_time parameter
Post by: VS on January 06, 2013, 10:55:17 AM
I guess there was no need to bump versions, since the change was only a bug fix... The makeobj version would be 55a or something, then.
Title: Re: Maximum of build_time parameter
Post by: greenling on January 06, 2013, 11:45:36 AM
I think it better to make a new makeobj 56 than a makeobj 55a.
that keep a better bughunting.
Title: Re: Maximum of build_time parameter
Post by: Dwachs on January 06, 2013, 01:54:27 PM
Combuijs, could you test

http://simutrans-germany.com/files/upload/makeobj.zip

? If it works, I will upload it to sourceforge. It is still makeobj 55 but fixed.

Edit: version info should needs to be corrected.
Title: Re: Maximum of build_time parameter
Post by: greenling on January 06, 2013, 05:35:09 PM
Dwachs
it those Makeobj in the Link for Windows useable?
Title: Re: Maximum of build_time parameter
Post by: Dwachs on January 06, 2013, 06:09:53 PM
Please test! It should work
Title: Re: Maximum of build_time parameter
Post by: greenling on January 06, 2013, 07:44:33 PM
Thank You Dwachs.
I will test  so quick as can.
Title: Re: Maximum of build_time parameter
Post by: Combuijs on January 06, 2013, 11:01:23 PM
Sorry Dwachs, just came home, so could not test it earlier.

Your version works! In the curiosity builder the right building time is indicated, and while extending a city the curiosity is built.

Thank you for quick reaction!