Add explanation of STATIC_ASSERTS in pokemon.c (#4294)
This commit is contained in:
parent
8f2f6811fb
commit
4a102dca8e
1 changed files with 14 additions and 0 deletions
|
@ -743,6 +743,20 @@ static const u32 sCompressedStatuses[] =
|
|||
// - The maximum PP.
|
||||
// - The maximum HP.
|
||||
// - The maximum form countdown.
|
||||
|
||||
// The following STATIC_ASSERT will prevent developers from compiling the game if the value of the constant on the left does not fit within the number of bits defined in PokemonSubstruct0 (currently located in include/pokemon.h).
|
||||
|
||||
// To successfully compile, developers will need to do one of the following:
|
||||
// 1) Decrease the size of the constant.
|
||||
// 2) Increase the number of bits both on the struct AND in the corresponding assert. This will likely break user's saves unless there is free space after the member that is being adjsted.
|
||||
// 3) Repurpose unused IDs.
|
||||
|
||||
// EXAMPLES
|
||||
// If a developer has added enough new items so that ITEMS_COUNT now equals 1200, they could...
|
||||
// 1) remove new items until ITEMS_COUNT is 1023, the max value that will fit in 10 bits.
|
||||
// 2) change heldItem:10 to heldItem:11 AND change the below assert for ITEMS_COUNT to check for (1 << 11).
|
||||
// 3) repurpose IDs from other items that aren't being used, like ITEM_GOLD_TEETH or ITEM_SS_TICKET until ITEMS_COUNT equals 1023, the max value that will fit in 10 bits.
|
||||
|
||||
STATIC_ASSERT(NUM_SPECIES < (1 << 11), PokemonSubstruct0_species_TooSmall);
|
||||
STATIC_ASSERT(NUMBER_OF_MON_TYPES + 1 <= (1 << 5), PokemonSubstruct0_teraType_TooSmall);
|
||||
STATIC_ASSERT(ITEMS_COUNT < (1 << 10), PokemonSubstruct0_heldItem_TooSmall);
|
||||
|
|
Loading…
Reference in a new issue