Variadic IS_BATTLER_OF_TYPE and GetBattlerTypes #5708
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.
@AlexOn1ine wanted something like
!IS_BATTLER_ANY_TYPE(gBattlerAttacker, TYPE_ROCK, TYPE_GROUND, TYPE_STEEL)
.In addition to that I added
GetBattlerTypes
which computes all the types at the same time, to improve the performance of any code which checks multiple types at once, and updated allGetBattlerType
s to use the new function.So that downstream code continues to work:
GetBattlerType
is implemented in terms ofGetBattlerTypes
.IS_BATTLER_OF_TYPE
is implemented in terms ofIS_BATTLER_ANY_TYPE
.Things to note in the release changelog:
IS_BATTLER_ANY_TYPE
should be preferred toIS_BATTLER_OF_TYPE
whenever more than one type is being checked.GetBattlerTypes
should be preferred toGetBattlerType
whenever more than one type is being checked.