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

Move more body_part to bodypart_id #40138

Merged
merged 8 commits into from
May 8, 2020
Merged

Conversation

Fris0uman
Copy link
Contributor

@Fris0uman Fris0uman commented May 4, 2020

Summary

SUMMARY: Infrastructure "Move more body_part to bodypart_id in temperature related functions"

Purpose of change

Part of #39068

Describe the solution

Describe alternatives you've considered

Testing

Compile without error

Additional context

@kevingranade
Copy link
Member

IDK if it's a false negative, but this is triggering an issue in the behavior test.

@kevingranade
Copy link
Member

I also got an immediate crash on loading a game, so I'm going with that being a real problem :D

@mlangsdorf mlangsdorf added Mechanics: Character / Player Character / Player mechanics Mechanics: Temperature Freezing, cooling, thawing, heating, etc. mechanics labels May 5, 2020
temp_equalizer( bodypart_id( "torso" ), bodypart_id( "leg_r" ) );
temp_equalizer( bodypart_id( "torso" ), bodypart_id( "head" ) );
}
if( bp == bodypart_id( "head" ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a little ugly, but this should probably be a series of else if statements for a mild improvement in performance.

I'm not sure if it's worth predeclaring the bodypart_ids as consts.

Ideally, all this would go away and be replaced by lists of bodypart_ids to be equalized attached to each bodypart_id, but that's obviously beyond the scope of this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An alternate intermediate solution would be to have e.g. a hardcoded unordered_map<bodypart_id, vector<bodypart_id>>. That might lead to cleaner code, but I don't think it matters that much.

Copy link
Contributor

@mlangsdorf mlangsdorf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Straightforward search and replace refactor with hopefully no semantic changes.

@kevingranade kevingranade merged commit 50ffd5b into CleverRaven:master May 8, 2020
@Fris0uman Fris0uman deleted the bodyenum branch May 8, 2020 09:29
Coolthulhu referenced this pull request in cataclysmbnteam/Cataclysm-BN Mar 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mechanics: Character / Player Character / Player mechanics Mechanics: Temperature Freezing, cooling, thawing, heating, etc. mechanics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants