The International Simutrans Forum

Simutrans Extended => Simutrans-Extended bug reports => Simutrans-Extended development => Simutrans-Extended closed bug reports => Topic started by: Ranran(retired) on April 23, 2020, 09:08:47 AM

Title: [Bug] The population sorting in the city list dialog is broken
Post by: Ranran(retired) on April 23, 2020, 09:08:47 AM
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.
Title: Re: [Bug] The population sorting in the city list dialog is broken
Post by: Mariculous on April 23, 2020, 09:22:48 AM
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.
Title: Re: [Bug] The population sorting in the city list dialog is broken
Post by: Ranran(retired) 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 (https://github.com/jamespetts/simutrans-extended/pull/155) so please check it.
Title: Re: [Bug] The population sorting in the city list dialog is broken
Post by: Vladki on April 27, 2020, 11:16:14 AM
Quote from: Ranran on April 27, 2020, 09:56:19 AMeinwohner
inhabitant
Title: Re: [Bug] The population sorting in the city list dialog is broken
Post by: Mariculous on April 27, 2020, 11:23:53 AM
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.
Title: Re: [Bug] The population sorting in the city list dialog is broken
Post by: jamespetts on May 02, 2020, 09:44:57 AM
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 (https://github.com/jamespetts/simutrans-extended/pull/155) 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)?