News:

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

[Bug] The population sorting in the city list dialog is broken

Started by Ranran, April 23, 2020, 09:08:47 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ranran

Hi. (´・ω・`)らんらんよー
There are 3 sorts option in the city list. I have noticed that the "Population" sorting is currently broken. It does not line up in order of population.  :-|


Confirmation method:
Just open the city list.
This bug is obvious in domo.sve


but, it is more clearly comfirmable when creating a new city, as the ability to create a new city is currently broken. New villages with no population are listed above the cities with a population.  ???
Please make more than one of them. They may not be next to each other even though they are both 0.
By the way, standard's population sorting is not broken.

Sirius

My guess is they are sorted by internal inhabitant number rather than actual inhabitants, which doesn't really make sense for sure.
I am currently working at a fix to the city growth anyway. I'll have a look at it.

In standard, there are not that many cases in which the actual inhabitant number can diverge from the
internal counter.
In extended, there are quite a lot of these.

I guess the prefered solution in extended would be showing and sorting by 1. inhabitants, 2. jobs and 3. a sum of both?
I will try to add those and make the sorting work properly to the displayed number.

Ranran

I'm looking into the code for displaying the population and class distribution of a city, and I happened to find the part that caused that bug. (I did not understand the meaning of get_einwohner in German, so I searched for the code and it was that.)
It was comparing internal size rather than population as Freahk pointed out.
Now I think I fixed this.
@James - I have submitted a pull request so please check it.


Sirius

Moreover "population" or "inhabitants" in this case.
Note that "(der) Einwohner" is singular, "(die) Einwohner" is plural (no they won't die), but from context, singular interpretation doesn't make sense here.
However, as you have already figured out, it's just an internal counter that is kind of related to the actual population.

jamespetts

Quote from: Ranran on April 27, 2020, 09:56:19 AM
I'm looking into the code for displaying the population and class distribution of a city, and I happened to find the part that caused that bug. (I did not understand the meaning of get_einwohner in German, so I searched for the code and it was that.)
It was comparing internal size rather than population as Freahk pointed out.
Now I think I fixed this.
@James - I have submitted a pull request so please check it.

Thank you very much for this - now incorporated.

Can anyone confirm that this is fixed with to-morrow's nightly build (3 May 2020 or later)?
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.