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

Fix faction camp blueprint recipe autocalculation consistency #37628

Merged
merged 4 commits into from Feb 1, 2020

Conversation

Qrox
Copy link
Contributor

@Qrox Qrox commented Feb 1, 2020

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

  1. 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.
  2. 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.
  3. Refactoring 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.
  4. Updated faction camp blueprint recipes by running the unit test and the auto updating script.

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.

@ifreund ifreund added (P2 - High) High priority (for ex. important bugfixes) <Bugfix> This is a fix for a bug (or closes open issue) Code: Tests Measurement, self-control, statistics, balancing. [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON Crafting / Construction / Recipes Includes: Uncrafting / Disassembling labels Feb 1, 2020
@ZhilkinSerg ZhilkinSerg merged commit 33ee5f8 into CleverRaven:master Feb 1, 2020
@Qrox Qrox deleted the fix-recipe-check branch February 2, 2020 03:05
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` Code: Tests Measurement, self-control, statistics, balancing. Crafting / Construction / Recipes Includes: Uncrafting / Disassembling [JSON] Changes (can be) made in JSON (P2 - High) High priority (for ex. important bugfixes)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants