Allow black/whitelisting scenarios #37575
Merged
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: Infrastructure "Add scenario whitelist/blacklist capability"
Purpose of change
@I-am-Erk wanted this for Cataclysm: Dark Days of the Dead
Describe the solution
In the character selection menu, skip displaying a scenario if it has been blacklisted.
Add
struct scen_blacklist
, containing astd::set
of the ids of blacklisted scenarios, and abool whitelist
.Add member functions for loading and finalizing this blacklist.
Create a file-global instance of this struct in
scenario.cpp
, and use it as the loaded blacklist.Add
scenario::scen_is_blacklisted()
that checks if the scenario is on that blacklist.Describe alternatives you've considered
Making whitelists and blacklists separate, but I felt that was unecessary, and this is functional.
Testing
Create a mod with this as the
modinfo.json
, and switch the subtype betweenwhitelist
andblacklist
.