Skip to main content
Topic: Change to city growth code. (Read 3816 times) previous topic - next topic

Change to city growth code.

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.

Re: Change to city growth code.

Reply #1
Thank you for this - will test it presently. How does renovation_percentage need adjusting for this patch?
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.


Re: Change to city growth code.

Reply #3
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?
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.

Re: Change to city growth code.

Reply #4
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.

 

Re: Change to city growth code.

Reply #5
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?
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.

Re: Change to city growth code.

Reply #6
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)