Clean up the profession and scenario code #20254
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.
Changes:
scenario::traitquery
comprehensive: a trait is permitted by a scenario if and only if it returns true.scenario::get_permitted_professions
public. Do away withscenario::profquery
since that was only used to manually find out whatscenario::permitted_professions
would return.scenario
and some dead code fromprofession
.profession::locked_traits
andscenario::locked_traits
tois_locked_trait
, renameprofession::traits
toget_locked_traits
and add thescenario::get_locked_traits
function.Character::add_traits
is no longer the bottleneck in thestarting_items
test (see Never give new characters unusable food or clothing (part 1) #19924) since it doesn't need to loop over every trait that exists. With the mutation stuff not commented out, it still takes 110 minutes (down from 317 minutes), but it's a good start, and I'll address that in a future PR.scenario::forbidden_traits
andprofession::forbidden_traits
tois_forbidden_trait
to be consistent with the above.