-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Expand generic factory to include relative and proportional support. #43144
Expand generic factory to include relative and proportional support. #43144
Conversation
Maybe do the conversion to |
Based on the |
cf1af42
to
514a9d8
Compare
10d6a2d
to
a047be4
Compare
a047be4
to
7036c0a
Compare
93ce5b0
to
a1073a7
Compare
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not 'bump' or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not 'bump' or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered. |
d9a9c7c
to
e007687
Compare
Fairly sure everything here is working and is in a good enough state for this to be merged. So I think this is just waiting on 0.F. |
Should this have 0.F feature freeze tag? |
As the person who introduced that bug, as far as I can tell, it's a display issue. As long as the damage is loaded using |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not 'bump' or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered. |
e007687
to
38e24a2
Compare
38e24a2
to
a0c772b
Compare
Copies entire entry, replace using copy-from once CleverRaven#43144 will get merged
Copies entire entry, replace using copy-from once CleverRaven#43144 will get merged
a0c772b
to
a8e0819
Compare
In the hope of eventually removing the assign() functions, and expanding support for generic factory (and continuing to support existing use cases), generic_factory needs to support relative and proportional. To do this, do some template vodoo. Create two templated structs, and take advantage of SFINAE (yeah, I had to look that up) with these to determine which template function to use. Three basically discriminate between whether or not the type can specify value proportionally or relatively. For proportionally, this is whether or not the type can be multiplied by a float, and for relative, this is whether or not the type can use the += operator with itself. Also, add some error checking for when a proportional value is inappropriately specified. Containers using the reader functions do not have proportional and relative support, because I'm not sure of a use case where that ever makes sense. Huge thanks to jbytheway for helping me use template vodoo to accomplish this.
a8e0819
to
ea2994e
Compare
Copies entire entry, replace using copy-from once CleverRaven#43144 will get merged
* Add option to raise the visor to motorcycle helmet Copies entire entry, replace using copy-from once #43144 will get merged * Add option to raise the visor to motorcycle helmet * remove deprecated armor_portion_data * Update data/json/items/armor/helmets.json
Summary
SUMMARY: Infrastructure "Allow using relative and proportional with generic_factory"
Purpose of change
In the hope of eventually removing the assign() functions, and expanding support for generic factory (and continuing to support existing use cases), generic_factory needs to support relative and proportional.
Also, some enums needed to be converted to enum classes so the compiler wouldn't get confused and try to use them with proportional.
Fixes #43117
Describe the solution
To do this, do some template vodoo.
Create two templated structs, and take advantage of SFINAE (yeah, I had to look that up) with these to determine which template function to use.
Three basically discriminate between whether or not the type can specify value proportionally or relatively.
For proportionally, this is whether or not the type can be multiplied by a float, and for relative, this is whether or not the type can use the += operator with itself.
Also, add some error checking for when a proportional value is inappropriately specified.
Huge thanks to jbytheway for helping me use template vodoo to accomplish this.
Testing
Game loads without error. Bio-chitin armor has acid protection.