The International Simutrans Forum

 

Author Topic: [Bug] The population sorting in the city list dialog is broken  (Read 425 times)

0 Members and 1 Guest are viewing this topic.

Offline Ranran

  • Devotee
  • *
  • Posts: 1161
  • Languages: ja
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.

Offline Freahk

  • Devotee
  • *
  • Posts: 1257
  • Languages: DE, EN
Re: [Bug] The population sorting in the city list dialog is broken
« Reply #1 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.
« Last Edit: April 23, 2020, 09:57:59 AM by Freahk »

Offline Ranran

  • Devotee
  • *
  • Posts: 1161
  • Languages: ja
Re: [Bug] The population sorting in the city list dialog is broken
« Reply #2 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.

Offline Vladki

  • Devotee
  • *
  • Posts: 3407
    • My addons, mostly roadsigns, pak128.cs
  • Languages: EN, CS

Offline Freahk

  • Devotee
  • *
  • Posts: 1257
  • Languages: DE, EN
Re: [Bug] The population sorting in the city list dialog is broken
« Reply #4 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.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 20207
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: [Bug] The population sorting in the city list dialog is broken
« Reply #5 on: May 02, 2020, 09:44:57 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)?