CleverRaven/Cataclysm-DDA

Item groups with type "distribution" lack proper consistency checks

Open

#62.446 aperta il 28 nov 2022

Vedi su GitHub
 (0 commenti) (0 reazioni) (0 assegnatari)C++ (3991 fork)batch import
(S2 - Confirmed)Code: TestsHelp WantedSpawn[C++]

Metriche repository

Star
 (9264 star)
Metriche merge PR
 (Merge medio 6g 5h) (292 PR mergiate in 30 g)

Descrizione

Describe the bug

There are item groups that can cause rare CI errors as already pointet out in other issues (#60784, #59873). They're hard to identify because consistency checks are incomplete. Item_spawn_data::check_consistency is supposed to create a maximized item group, but completely ignores it for groups with the type distribution.

https://github.com/CleverRaven/Cataclysm-DDA/blob/4034a38d4bae1abb7f208ba1a63630e05de02662/src/item_group.cpp#L701-L721

For collections it checks for flags & spawn_flag::maximized to spawn everything without randomness, but it's obviously not that easy for distributions where there are multiple paths that would all have to be checked.

Steps to reproduce

Add an item group like this where one entry fits the container, the other doesn't:

  {
    "id": "test_group_faulty_distribution",
    "type": "item_group",
    "subtype": "distribution",
    "container-item": "bottle_plastic",
    "entries": [ { "item": "anvil" }, { "item": "paper" } ]
  }

Then run tests (with all test cases filtered out, just loading the json) and only see it sometimes fail on the anvil.

Expected behavior

Item groups don't have errors and creators are informed if there can be issues.

Screenshots

No response

Versions and configuration

4034a38d4bae1abb7f208ba1a63630e05de02662

Additional context

No response

Guida contributor