longturn / freeciv21

Develop your civilization from humble roots to a global empire
GNU General Public License v3.0
214 stars 39 forks source link

Sort unit lists shown to the user #2288

Closed lmoureaux closed 3 weeks ago

lmoureaux commented 1 month ago

On top of #2287 - check the second commit.

This patch makes the user interface look more consistent by sorting units in two contexts:

The sorting logic is an improved version of code formerly used to sort units in the city dialog (but that had been lost for some reasion). It tries to produce a sort order that looks natural and is stable in time. To do so:

I tested this logic in a few contexts and it seems to achieve its goal. With respect to the previous sorting function, I removed an order based on unit activities (fortified, fortifying, sentried) because it felt wrong to have a unit move in the list just because I changed its activity.

Closes #1836. See #1838.

lmoureaux commented 1 month ago

The order you show is not what I intended, the planes should come right after the carrier and the defending rifles should be first. This is strange...

I agree that more rows should be shown if possible, but right now I'm not sure how to do that (it's not the same widget as in the unit thing).

jwrober commented 1 month ago

Ok. Loaded units "before" vs "after" is a thing. As long as we are consistent either is ok with me. Maybe sorting still needs some work. I'm also ok with tackling the city dialog scaling to two rows later.

jwrober commented 1 month ago

Everything looks good except for the situation where a ship with loaded units is present in the city. The dialog shows the ship + loaded units first and then best defender.

lmoureaux commented 1 month ago

Ok will check, thanks

lmoureaux commented 3 weeks ago

Everything looks good except for the situation where a ship with loaded units is present in the city. The dialog shows the ship + loaded units first and then best defender.

I can't reproduce this behavior