Fix faction camp blueprint recipe autocalculation consistency #37628
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
SUMMARY: None
Purpose of change
Migrating construction to use int/string ids revealed an asymmetry of
requirement_data::consolidate
, that is, the result of consolidation depends on the order of requirement lists, and it's causing test failure in the CI builds (see #37436 (comment)). This could be fixed by only merging requirement lists that have the exact same components, but that produced complex recipes which generated over 3000 alternatives. Since it's nowhere near sane to ask the player to choose from a list of 3000 choices when they just want to upgrade their dining room, I decided to tolerate a little asymmetry and simplify the recipes by merging longer requirement lists in to shorter ones if the shorter list is a subsequence of the longer list. To ensure consistency, the lists are first sorted in lexicographical order.Describe the solution
requirement_data::has_same_requirements_as
now sorts the requirement lists before comparison, so requirements with effectively the same meaning are treated as the same.requirement_data::consolidate
now sorts the requirement lists and merge similar requirement lists according to the criteria mentioned before, and in the process makes the requirements stricter but simpler.requirement_data::consolidate
also revealed some incorrect quality requirements in construction definitions, which were intended to be AND relation but were specified as OR relation. Fixed them.Describe alternatives you've considered
Offer 3024 solutions to player's home improvement needs.
Testing
Ran the unit test, and the blueprint requirement check and recipe complexity check passed.
Started game, checked construction / recipe / faction camp blueprint requirements and all were working.