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

Clean up the profession and scenario code #20254

Merged
merged 4 commits into from
Feb 23, 2017

Conversation

sethsimon
Copy link
Contributor

Changes:

  • Make scenario::traitquery comprehensive: a trait is permitted by a scenario if and only if it returns true.
  • Make scenario::get_permitted_professions public. Do away with scenario::profquery since that was only used to manually find out what scenario::permitted_professions would return.
  • Remove a lot of dead code from scenario and some dead code from profession.
  • Rename profession::locked_traits and scenario::locked_traits to is_locked_trait, rename profession::traits to get_locked_traits and add the scenario::get_locked_traits function. Character::add_traits is no longer the bottleneck in the starting_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.
  • Rename scenario::forbidden_traits and profession::forbidden_traits to is_forbidden_trait to be consistent with the above.

Seth Simon added 4 commits February 8, 2017 00:52
-scenario::missions was unused
-scenario::gender_req and profession::gender_req were unused
-All scenarios have the same English name for both genders
-The ALL_STARTS scenario flag is unused
-No scenario defines starting items
-Do away with scenario::profsize
-Do away with scenario::profquery
-Make scenario::permitted_professions public
-Remove unneeded sorting from scenario::permitted_professions
-Remove the unused member variable scenario::traits
-Rename scenario::locked_traits and profession::locked_traits to is_locked_trait
-Rename scenario::forbidden_traits to scenario::is_forbidden_trait
-Fix default professions, remove scenario::get_default_profession
-Make scenario::traitquery comprehensive. A scenario permits a trait if and only if traitquery returns true.
-Add scenario::get_locked_traits and profession::get_locked_traits and use them in Character::add_traits. This speeds up the partial starting_items test from 3 to 2.5 minutes, and the full one- the one that has been commented out because it takes too long- from 317 minutes to 110 minutes.
@Night-Pryanik
Copy link
Contributor

Won't this remove the gender-specific scenario names?

@Zireael07
Copy link
Contributor

haracter::add_traits is no longer the bottleneck in the starting_items test (see #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),

Yaaay!

@sethsimon
Copy link
Contributor Author

Won't this remove the gender-specific scenario names?

Yes and no. You won't be able to declare it as

"name": {
    "male": "foo",
    "female": "bar"
}

anymore, but I couldn't find any scenarios that declared it like that, not even in mods. Instances where two names have two possible translations depending on the gender will still work as expected.

Yaaay!

Ha, almost. But no celebrating till it reaches an hour.

@Coolthulhu Coolthulhu self-assigned this Feb 23, 2017
@Coolthulhu Coolthulhu merged commit 44d84fd into CleverRaven:master Feb 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants