Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort unit lists shown to the user #2288

Merged
merged 1 commit into from
Jun 13, 2024

Commits on May 21, 2024

  1. Sort unit lists shown to the user

    This patch makes the user interface look more consistent by sorting
    units in two contexts:
    
    * In the city dialog
    * In the unit picker
    
    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:
    
    * Loaded units are always sorted right after their transport, so one can
      tell in which transport they are loaded;
    * The best defensive units go to the beginning of the list. These tend
      to stay in cities and not move around too much;
    * Tie breaker by unit type and nationality ensure similar units are
      grouped together;
    * Finally, the unit id is used as a last resort.
    
    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 longturn#1836.
    See longturn#1838.
    lmoureaux committed May 21, 2024
    Configuration menu
    Copy the full SHA
    83bde24 View commit details
    Browse the repository at this point in the history