The International Simutrans Forum

Simutrans Extended => Simutrans-Extended development => Simutrans-Extended bug reports => Topic started by: Ranran(retired) on November 26, 2021, 12:50:02 PM

Title: Padded city chart numbers. (Jobs/Visitor demand)
Post by: Ranran(retired) on November 26, 2021, 12:50:02 PM
(´・ω・`)Oppaaaai!

I found that Jobs and Visitor demand in the city chart are padded. Population, on the other hand, is not falsified.

Confirmation procedure:
Make a bus stop that can cover an entire small village and compare the numbers on the station detail screen and the city chart. They are contradictory. The population seems to be correct.
This implies that one of the dialogs is making a false report, I think.
Next, create a new city by the public player and perform the same verification process.
Oddly, they both tell the same value. ???

Next, destroy all buildings, except town halls, from the city suspected of data fraud.
That way there is no doubt that the correct number of jobs and visitor demand is the number City Hall has.
Then you can see that the liar is a chart of the city info dialog. This is because the chart for a city with only a city hall does not match the value of the city hall.
And the station details prove to have told the truth.

These facts suggest that, for some reason, job demand and visitor demand for cities that exist from the start of the game are padded up.
Note that cities placed manually after the game starts will record the correct values.

This means that the bug occurs during the map generation process.
Employment and other numbers are subtracted or added from the city chart every time a building is broken or planted.
This means that there is no double-checking (looking at the whole thing) to see if it is correct or not.
So even if the problem is fixed, those values in the existing save data will not be restored to normal again without a data retrieval process.
The world values may also be wrong, although I have not checked.
Title: Re: Padded city chart numbers. (Jobs/Visitor demand)
Post by: Ranran(retired) on January 21, 2022, 09:02:21 AM
I have investigated this bug.
The code is very different from standard and complex. And for some reason update_city_stats_with_building is called twice when generating the map.
Therefore, it tries to count the city statistics twice.
But oddly enough, the first time, all the buildings return a population of 0. So after two runs, it get the correct population.
The job returns the correct value both times. So after two runs, it get the value multiplied by two.
The visitor demand does not seem to get the correct value.
I couldn't fix it because I didn't know why I couldn't get the correct value. (´・ω・`)
However, saving and reloading the game will correct the current values. Therefore, I consider it to be less critical.
Title: Re: Padded city chart numbers. (Jobs/Visitor demand)
Post by: jamespetts on January 21, 2022, 09:52:49 PM
Thank you very much for investigating this. All of the town related data are in a somewhat transitional state; the passenger generation code from a few years ago was intended to work with the planned new town growth code, but the latter has not yet been implemented, so much legacy code remains, together with sub-optimal interactions between it and the newer code. I am reluctant to put too much effort into non-critical bugs in this area of the code before the town growth update has been produced.