Fix GetMonData and GetBoxMonData signatures #3170
Closed
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.
Description
Fixes the function signatures for GetMonData and GetBoxMonData. Thanks Gamefreak.
I did most of the changes with a pretty strict regex, but I skimmed through the changes for potential errors and didn't see any. There's one actual change in here that isn't just changing the signatures and adding NULL in place of the data buffer and it's at line 415 of daycare.c, where there was actually a bug that this change caught already (DaycareMon passed in, instead of BoxMon - no real effect since it was just a zero/null check, though).
There are probably "better" solutions to this problem, but this is the only one that doesn't involve unions, macros, creating additional/differently typed functions, or other widespread refactors. Might be worth looking into alternatives eventually, when doing other refactors, but this is a safety, usability, and clarity improvement in the meantime.
Discord contact info
crater.