The International Simutrans Forum

Simutrans Extended => Simutrans-Extended development => Topic started by: inkelyad on July 28, 2010, 08:32:13 pm

Title: Change to city growth code.
Post by: inkelyad on July 28, 2010, 08:32:13 pm
Pushed to my github devel branch.

Cities will grow with more dense central part.

and cityrules.tab parameters for new code:

renovations_count -- how many buildings will be renovated in one step.
renovations_try -- How many attempts we will do to find them.

Don't forget to adjust renovation_percentage.

As usual, I need better names for variables/parameters.
Title: Re: Change to city growth code.
Post by: jamespetts on July 28, 2010, 09:08:02 pm
Thank you for this - will test it presently. How does renovation_percentage need adjusting for this patch?
Title: Re: Change to city growth code.
Post by: inkelyad on July 28, 2010, 09:18:54 pm
How does renovation_percentage need adjusting for this patch?
-10%, I think.
Title: Re: Change to city growth code.
Post by: jamespetts on July 28, 2010, 09:28:28 pm
Might I ask - why does this need adjusting in this way? Also, I have just applied the patch: when I try to generate a new map, I get a runtime error relating to an uninitialised variable "f" at line 4345 of simcity.cc - what is "f" for?

Edit: That seems to be fixed by setting f to 1.0 at line 4312, but does this alter the intended behaviour?
Title: Re: Change to city growth code.
Post by: inkelyad on July 29, 2010, 03:28:46 am
Might I ask - why does this need adjusting in this way?
I don't know. It just looks that way. Trial & error decision.
My patch uses renovation_percentage in somewhat different way then before => new 'best' value must be found.

Also, I have just applied the patch: when I try to generate a new map, I get a runtime error relating to an uninitialised variable "f" at line 4345 of simcity.cc - what is "f" for?
Yes. it wil break 'city avoid  high place' behaviour.
It was cut&paste error in my commit 3bae1da8f2eaa26a1d9400a73ed9878b437c1c27.
Fix pushed to github.
Title: Re: Change to city growth code.
Post by: jamespetts on July 29, 2010, 08:45:10 am
Inkelyad,

thank you for your answers and for your fix, which I shall apply when I get a chance: that is most helpful. How does your patch alter how "renovation_percentage" works?
Title: Re: Change to city growth code.
Post by: inkelyad on July 29, 2010, 09:29:15 am
Without too much details and in pseudo-code:
Before:
Code: [Select]
if simrand(100) <= renovation_percentage:
    try to renovate building via renoviere_gebaeude
renoviere_gebaeude not always do renovation. In my version it is checked.
Code: [Select]
if simrand(100) <= renovation_percentage:
    try to renovate building until we renovate renovations_count buildings ( or we do too many attempts)