-
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
Reworked how crafting skill requirement display is generated. #36089
Reworked how crafting skill requirement display is generated. #36089
Conversation
bdccd52
to
86b82e4
Compare
src/recipe.cpp
Outdated
std::string recipe::required_skills_string() const | ||
// Format a std::pair<skill_id, int> for the basecamp bulletin board. | ||
// skill colored white with difficulty in parenthesis. | ||
template<typename _FIter> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that I based this off existing code:
https://github.com/CleverRaven/Cataclysm-DDA/blob/master/src/output.h#L690
11a3a60
to
d0f132d
Compare
d0f132d
to
4a92f3a
Compare
Co-Authored-By: BevapDin <[email protected]>
Co-Authored-By: BevapDin <[email protected]>
Co-Authored-By: BevapDin <[email protected]>
Removed the includes I had added into recipe.h for the templates. Moved the templates out of the recipe class since the templates didn't access any member variables. Renamed the templates from required_skills_string to required_skills_as_string to avoid confusing the compiler.
Co-Authored-By: John Bytheway <[email protected]>
…rators. Use copy instead of for loop. Addressing PR comments.
4a92f3a
to
157857f
Compare
We obviously want the bugfix, but it's not clear to me that the other changes are a meaningful improvement, and I'm definitely not touching it before 0.E is out. |
Summary
SUMMARY: Bugfixes "Reworked crafting skill requirement display to be more consistent while fixing a bug"
Purpose of change
Fixes #35336
While fixing the bug I found a number of inconsistencies on how generating the text for crafting skill requirements were being generated.
I cleaned it up and fixed the original bug.
There are some additional oddities around basecamp recipes and their use of the primary skill used but those are separate issues that should be handled in a different PR.
Describe the solution
Turned the text generation into a pair of templates for the crafting gui and basecamp.
These templates will take any sort of container that is a pair<skill_id, int>.
Reworked the helper functions to use the new templates.
Testing
Loaded up a save with a basecamp that has recipes.
Verified that the basecamp recipes and crafting recipes display as expected.
Verified that the oddities I saw in basecamp recipes around skills with 0 difficulty or duplicated skills were actually configured that way in the json.