-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Implement display toggle for zones #71262
Conversation
I don't know how to resolve the reported error in pre existing code: Error: /home/runner/work/Cataclysm-DDA/Cataclysm-DDA/src/clzones.cpp:1737:9: error: Called C++ object pointer is null [clang-analyzer-core.CallAndMessage,-warnings-as-errors] Is it a case of not recognizing a custom pointer as being a pointer (again: had a previous case where I was demanded to change existing code to make a reference to a custom pointer (and then de-referencing it when used)? |
I think it's because clang-tidy does not know that these zone types can only have |
Implement display toggle for zones
Implement display toggle for zones
Summary
None
Purpose of change
Fix #70992, i.e. implement a display toggle for zones to allow players to select whether to show the zones or not (default off).
By-catch fix of UI bug where the cursor always was placed at the end of the zone list when creating a new zone, even though zones tied to vehicles are placed at the end. Now the cursor ends up at the newly created zone.
Describe the solution
Define one field for each kind of zone with a distinct character tied to the field. Add a toggle to the zone UI to allow the zones to be displayed and hidden.
Reorganized the zones between the two files defining them to make somewhat more sense, plus sorted them in alphabetic order.
The new display fields are placed in a separate file.
Updated the JSON format for zones to have a mandatory JSON field referencing a field object (unfortunate English word overload there...).
Encountered and fixed bug where removal of a field ended up in an eternal loop because the iterator wasn't progressed when the field to be removed wasn't the first one.
Describe alternatives you've considered
The glyphs assigned to the fields associated to the various zones could have been done differently. There will probably be suggestions. After all, this is almost a perfect bike shed issue (but I'm not saying suggestions won't be valid: the selection is closer to arbitrary than perfect).
There's a zone that's partially implemented, but doesn't show up in the list of available zones, LOOT_ITEM_GROUP. I've added it to the new code, but am not going to make any attempt to make it available: I don't know if the associated code is implemented, and don't want to deal with trying to make it work if it's buggy.
Testing
Screen shot at the end of testing (the percentage signs are not zone markers, but incomplete disassembly tasks):
Additional context