News:

Do you need help?
Simutrans Wiki Manual can help you to play and extend Simutrans. In 9 languages.

Maximum of build_time parameter

Started by Combuijs, November 19, 2012, 10:08:03 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Combuijs

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.
Bob Marley: No woman, no cry

Programmer: No user, no bugs



Ters

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.

VS

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

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

Combuijs

#3
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
Bob Marley: No woman, no cry

Programmer: No user, no bugs



prissi

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.)

Combuijs

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.
Bob Marley: No woman, no cry

Programmer: No user, no bugs



Ters

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.)

Fabio

Indeed 64k citizen is way too low a limit for attractions...

Combuijs

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.
Bob Marley: No woman, no cry

Programmer: No user, no bugs



Ters

When cities have become that big, I'm too busy with everything else to notice that attractions have stopped.

VS

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 :-/

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

sdog

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! ;-)

z9999+

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.

Dwachs

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).
Parsley, sage, rosemary, and maggikraut.

Combuijs

Bob Marley: No woman, no cry

Programmer: No user, no bugs



Combuijs

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?
Bob Marley: No woman, no cry

Programmer: No user, no bugs



Ters

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.

Combuijs

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"
Bob Marley: No woman, no cry

Programmer: No user, no bugs



Ters

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.)

VS

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.

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

greenling

I think it better to make a new makeobj 56 than a makeobj 55a.
that keep a better bughunting.
Opening hours 20:00 - 23:00
(In Night from friday on saturday and saturday on sunday it possibly that i be keep longer in Forum.)
I am The Assistant from Pakfilearcheologist!
Working on a big Problem!

Dwachs

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.
Parsley, sage, rosemary, and maggikraut.

greenling

Dwachs
it those Makeobj in the Link for Windows useable?
Opening hours 20:00 - 23:00
(In Night from friday on saturday and saturday on sunday it possibly that i be keep longer in Forum.)
I am The Assistant from Pakfilearcheologist!
Working on a big Problem!

Dwachs

Parsley, sage, rosemary, and maggikraut.

greenling

Thank You Dwachs.
I will test  so quick as can.
Opening hours 20:00 - 23:00
(In Night from friday on saturday and saturday on sunday it possibly that i be keep longer in Forum.)
I am The Assistant from Pakfilearcheologist!
Working on a big Problem!

Combuijs

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!
Bob Marley: No woman, no cry

Programmer: No user, no bugs