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

Reworked how crafting skill requirement display is generated. #36089

Merged

Conversation

ishtatann
Copy link
Contributor

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.

@curstwist curstwist added <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Info / User Interface Game - player communication, menus, etc. Crafting / Construction / Recipes Includes: Uncrafting / Disassembling labels Dec 14, 2019
src/recipe.cpp Outdated Show resolved Hide resolved
src/recipe.cpp Outdated Show resolved Hide resolved
src/recipe.cpp Outdated Show resolved Hide resolved
src/recipe.h Outdated Show resolved Hide resolved
src/recipe.cpp Outdated Show resolved Hide resolved
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>
Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

src/recipe.cpp Outdated Show resolved Hide resolved
src/recipe.cpp Outdated Show resolved Hide resolved
ishtatann and others added 9 commits January 7, 2020 17:56
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.
@kevingranade
Copy link
Member

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.

@kevingranade kevingranade merged commit 026c7b5 into CleverRaven:master Apr 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Crafting / Construction / Recipes Includes: Uncrafting / Disassembling Info / User Interface Game - player communication, menus, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crafting skill requirement display glitch
7 participants