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

create character_martial_arts class and change scope from player #35038

Merged
merged 6 commits into from
Oct 30, 2019

Conversation

KorGgenT
Copy link
Member

@KorGgenT KorGgenT commented Oct 26, 2019

Summary

SUMMARY: Infrastructure "Changes scope of various martial arts data from player to a new class"

Purpose of change

part of #34721

Describe the solution

I noticed that in player there were quite a number of members that were specifically related to martial arts. This gave me the idea to migrate these members into a new class called character_martial_arts that keeps any martialarts data and is used as an interface between a Character and its known martial arts. There were some functions related to martial arts that were actually just checking effects on the Character as well, so they stayed.

In addition to changing the scope of some members in player, it was necessary to change parameters of the functions in martialarts.h/cpp to Character instead of player.
Also, whenever i saw an auto in a function i touched, i murdered it in cold blood.

Describe alternatives you've considered

just moving them to Character

Testing

Loaded up a character pre-change and learned all styles via debug menu.
switched to the branch with the changes, and saw that all of the styles loaded properly (so the save/load migration works)
then save and load again.

Additional context

@KorGgenT KorGgenT added [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style labels Oct 26, 2019
@KorGgenT KorGgenT marked this pull request as ready for review October 27, 2019 02:29
@@ -619,6 +620,31 @@ class Character : public Creature, public visitable<Character>
// gets add and mult value from enchantment cache
double calculate_by_enchantment( double modify, enchantment::mod value,
bool round_output = false ) const;

/** Returns true if the player has any martial arts buffs attached */
Copy link
Member

Choose a reason for hiding this comment

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

This is an improvement right now, but ideally things outside of player wouldn't introspect into where bonuses come from, they would just get the needed character stats, and character would tabulate stuff based on matrial arts as necessary.

@kevingranade kevingranade merged commit be0d369 into CleverRaven:master Oct 30, 2019
@KorGgenT KorGgenT deleted the martial-arts-encapsulate branch August 13, 2020 04:20
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` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants