Implement config-driven unlock groups so that multiple things can be unlocked at once (including buildings)

This commit is contained in:
2026-07-22 21:34:59 +02:00
parent a8a6a04f1e
commit a9082c57f3
36 changed files with 1005 additions and 543 deletions

View File

@@ -36,7 +36,7 @@ static int findArtifactChoiceIndex(const Simulation& sim)
const auto& choices = sim.getPendingSchematicChoices();
for (int i = 0; i < static_cast<int>(choices.size()); ++i)
{
if (choices[static_cast<std::size_t>(i)].type == SchematicType::Artifact)
if (choices[static_cast<std::size_t>(i)].isArtifact)
{
return i;
}
@@ -86,7 +86,7 @@ TEST_CASE("ArtifactWinCondition: artifact option appears when chance formula ret
const auto& choices = sim.getPendingSchematicChoices();
const long artifactCount = std::count_if(choices.begin(), choices.end(),
[](const SchematicChoiceOption& opt) { return opt.type == SchematicType::Artifact; });
[](const SchematicChoiceOption& opt) { return opt.isArtifact; });
CHECK(artifactCount == 1);
// Exactly 2 schematic picks + 1 artifact (or fewer if pool was small)
CHECK(choices.size() <= 3);
@@ -105,7 +105,7 @@ TEST_CASE("ArtifactWinCondition: at most 2 schematic options accompany the artif
const auto& choices = sim.getPendingSchematicChoices();
const long schematicCount = std::count_if(choices.begin(), choices.end(),
[](const SchematicChoiceOption& opt) { return opt.type != SchematicType::Artifact; });
[](const SchematicChoiceOption& opt) { return !opt.isArtifact; });
CHECK(schematicCount <= 2);
}
@@ -161,7 +161,7 @@ TEST_CASE("ArtifactWinCondition: selecting a non-artifact option does not increm
// Pick the first non-artifact choice.
const auto& choices = sim.getPendingSchematicChoices();
const auto it = std::find_if(choices.begin(), choices.end(),
[](const SchematicChoiceOption& opt) { return opt.type != SchematicType::Artifact; });
[](const SchematicChoiceOption& opt) { return !opt.isArtifact; });
REQUIRE(it != choices.end());
SimulationTestAccess::applySchematicChoice(sim,static_cast<int>(it - choices.begin()));