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

Allow black/whitelisting scenarios #37575

Merged
merged 1 commit into from
Feb 3, 2020

Conversation

anothersimulacrum
Copy link
Member

@anothersimulacrum anothersimulacrum commented Jan 31, 2020

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 a std::set of the ids of blacklisted scenarios, and a bool 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

image
Create a mod with this as the modinfo.json, and switch the subtype between whitelist and blacklist.

[
  {
    "type": "MOD_INFO",
    "ident": "scenmod",
    "name": "No scenarios!",
    "authors": [ "anothersimulacrum" ],
    "maintainers": [ "you" ],
    "description": "Tests scenario blacklists",
    "dependencies": [ "dda" ]
  },
  {
    "type": "SCENARIO_BLACKLIST",
    "subtype": "whitelist",
    "scenarios": [ "largebuilding" ]
  }
]

src/scenario.cpp Outdated Show resolved Hide resolved
src/scenario.cpp Outdated Show resolved Hide resolved
@ZhilkinSerg ZhilkinSerg added <Enhancement / Feature> New features, or enhancements on existing [C++] Changes (can be) made in C++. Previously named `Code` Scenarios New Scenarios, balancing, bugs with scenarios labels Jan 31, 2020
I-am-Erk wanted this for reworking 'Classic Zombies', and making it a
more refined experience.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` <Enhancement / Feature> New features, or enhancements on existing Scenarios New Scenarios, balancing, bugs with scenarios
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants