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

Missing wild encounter constant usage in Match Call #1634

Open
GriffinRichards opened this issue Feb 22, 2022 · 3 comments
Open

Missing wild encounter constant usage in Match Call #1634

GriffinRichards opened this issue Feb 22, 2022 · 3 comments

Comments

@GriffinRichards
Copy link
Member

Currently constants for the distribution of wild Pokémon are generated from data in wild_encounters.json and written by the inja template to wild_encounters.h. Because this file contains data it can't be included elsewhere, and the constants can only be used in wild_encounter.c.

The constants should instead be defined in a separate file that can be included repeatedly so that they can be used in other places the values are referenced (in match call, specifically). If a user changes the encounter chances without the constants there then the distribution of wild Pokémon mentioned in match calls can skew, or it could read out of bounds of the encounter table.

@nonchip
Copy link

nonchip commented Apr 28, 2022

(somewhat related): Also, the constants from include/constants/wild_encounter.h are "missing" (it's not actually required in any vanilla code but would very much be nice to have) something like:

#define FISH_WILD_COUNT_OLD_ROD   2
#define FISH_WILD_COUNT_GOOD_ROD  3
#define FISH_WILD_COUNT_SUPER_ROD 5

@rawr51919
Copy link
Contributor

rawr51919 commented Jun 21, 2022

They were defined in a .h file before being made into JSON, we'd have to revert that in order to fix this issue
That or we make the modifications to the inja template and JSON

@nonchip
Copy link

nonchip commented Jun 22, 2022

we'd have to revert that in order to fix this issue

um no, obviously we wouldn't have to do that.

That or we make the madifications to the inja template

well yeah that's the point. make the template generate a .c file, drop the static, and have extern ... in a .h file that can be included wherever.

and JSON

nah that's not necessary either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants