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

Rewrite drawing of citizen sprites to use multiple rows #2144

Merged
merged 2 commits into from
Jan 8, 2024

Conversation

daavko
Copy link
Collaborator

@daavko daavko commented Jan 8, 2024

Several things in this PR:

  • Citizens are now drawn in multiple rows, where amount per row is controlled via CITIZENS_PER_ROW
  • Fixed specialist rotating code so the correct specialist is picked even for large cities
  • Add size hinting to city_label and several other places to prevent them being squished by the unit list when a city has too many units in it

Given that I don't really know C++, this is on a best-effort basis, but hopefully it's at least a bit helpful.

Fixes #2041
Could partially work for #1904 as well, since that's caused by too many citizens in the second tab

If a city is too large, the current logic will cause citizen sprites to overlap, which isn't very ergonomic. Instead, draw citizens in rows of a max size so players can see all of them.

Also fix specialist rotating logic which was broken when citizen sprites were overlapping.
@daavko daavko requested a review from lmoureaux January 8, 2024 01:01
Copy link
Contributor

@lmoureaux lmoureaux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks sensible and seems to work well.
image
image
The unit area doesn't push the sides aside even with many units in the city and the gigantic vectron sprites.

I only have two small comments on your C++, which looks very good already 😄

client/citydlg.cpp Show resolved Hide resolved
client/citydlg.h Outdated Show resolved Hide resolved
@lmoureaux lmoureaux enabled auto-merge (rebase) January 8, 2024 02:07
@lmoureaux lmoureaux merged commit e47bb57 into longturn:master Jan 8, 2024
19 checks passed
@lmoureaux lmoureaux deleted the fix/citydlg-citizen-drawing branch January 8, 2024 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Large cities lose ability to adjust specialists
2 participants