HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. Read more...
Feature #901393
closedQt: Add the city's size to the Info Panel of the City dialog.
0%
Description
Feature #872815 has a new patch from John Robertson to implement city's size display on city dialog of Qt-client.
Files
Updated by Marko Lindqvist over 2 years ago
- INFO_POPULATION is confusing. City population (at least 10000 people) as shown in the city dialog is different thing from the city size.
- Do not have 'default:' -case for the switch here. We don't want it to silence compiler warning about missing handling of an enum value here if someone adds a new one
Updated by John Robertson over 2 years ago
· Got it, I will change it to INFO_CITY_SIZE or maybe INFO_CITIZENS, whichever you might prefer.
· On the second point, ... the `default:` case is intended to catch the missing label for an added INFO_xxx enum. Is a soft warning or a hard exit preferred?
Updated by Marko Lindqvist over 2 years ago
John Robertson wrote:
· On the second point, ... the `default:` case is intended to catch the missing label for an added INFO_xxx enum. Is a soft warning or a hard exit preferred?
Catching it already at compile time (as an hard error with --enable-debug as is normal in development time) is preferred over maybe running on it on run time.
Updated by John Robertson over 2 years ago
The problem is that the list of labels is built at run-time, not compile time; both in the unchanged current code and the proposed patch. Thus I don't think that there can be a compile time check to assert that the number of elements match between the enum and the label list.
Additionally, the runtime building of the label list in the proposed patch is to ensure that the labels are in the same order as the enums for subsequent algorithmic convenience. The current code does not have an order guarantee.
Updated by Marko Lindqvist over 2 years ago
In addition to removing the 'default' case, you need to have 'i' to have correct enum type instead of being an int. Then the compiler will see if there's no 'case' for some value of 'i'. That's how all the other enum 'switch' cases in freeciv code work, and what CodingStyle document tells you to do.
Updated by John Robertson over 2 years ago
- File 901393-added-citizen-count-to-city_info-panel.patch 901393-added-citizen-count-to-city_info-panel.patch added
I like this version much better, .... thanks for the guidance.
Updated by Marko Lindqvist over 2 years ago
- File 0036-Qt-Add-city-size-to-city-info-panel.patch 0036-Qt-Add-city-size-to-city-info-panel.patch added
- Status changed from New to In Progress
A bit modified version:
- Fixed trailing whitespaces git was warning about (they probably were not caused by this patch, but just were on the lines touched)
- Keep original field names instead of translated ones in specenum, translate only when calling city_info_name()
- Dropped '+' sign from the number of specialists. It's not an addition to city size, but part of it (at first I thought that the number would indicate city growth)
Can you provide versions for the stable branches (this does not apply)?
Updated by John Robertson over 2 years ago
- File 1908-S3_0-Qt-Add-city-size-to-city-info-panel.patch 1908-S3_0-Qt-Add-city-size-to-city-info-panel.patch added
compiled and tested for S3_0
Updated by Marko Lindqvist over 2 years ago
- Status changed from In Progress to Resolved
- Assignee set to Marko Lindqvist
Updated by John Robertson over 2 years ago
I get various toolset deprecation errors in the S2_6_2 build. E.g.:
· `QT_DEPRECATED_X("Use default constructor instead") Q_DECL_CONSTEXPR inline QFlags(Zero) noexcept : i(0) {}`
· ` error: 'int QFontMetrics::width(const QString&, int) const' is deprecated: Use QFontMetrics::horizontalAdvance [-Werror=deprecated-declarations]`
I can work through an independent patch of these toolset updates, then produce an unencumbered city_panel patch, ...
or just abandon the city_panel patch for S2_6_2.
What would you recommend?
Updated by Marko Lindqvist over 2 years ago
Your S3_0 patch applied to S2_6 as is.
Qt deprecation warnings are Bug #896335.
Updated by Marko Lindqvist over 2 years ago
John Robertson wrote:
or just abandon the city_panel patch for S2_6_2.
For the record: S2_6_2 was a branch for emergency 2.6.2.1 release. It won't continue from there, unless we have to do another emergency release before 2.6.3 is ready, and even then only those critical fixes would be cherry-picked to it.
S2_6 is the freeciv-2.6 branch.
Updated by Marko Lindqvist over 2 years ago
- Status changed from Resolved to Closed