Merge pull request #396 from hjk321/storage-magic

Change embarassing magic numbers that should have been fixed a long time ago
This commit is contained in:
GriffinR
2021-02-22 11:26:52 -05:00
committed by GitHub
2 changed files with 6 additions and 5 deletions
+4 -3
View File
@@ -4,6 +4,7 @@
#include "global.h" #include "global.h"
#include "sprite.h" #include "sprite.h"
#include "constants/pokemon.h" #include "constants/pokemon.h"
#include "pokemon_storage_system.h"
struct PokemonSubstruct0 struct PokemonSubstruct0
{ {
@@ -125,9 +126,9 @@ struct Pokemon
struct PokemonStorage struct PokemonStorage
{ {
/*0x0000*/ u8 currentBox; /*0x0000*/ u8 currentBox;
/*0x0001*/ struct BoxPokemon boxes[14][30]; /*0x0001*/ struct BoxPokemon boxes[TOTAL_BOXES_COUNT][IN_BOX_COUNT];
/*0x8344*/ u8 boxNames[14][BOX_NAME_LENGTH + 1]; /*0x8344*/ u8 boxNames[TOTAL_BOXES_COUNT][BOX_NAME_LENGTH + 1];
/*0x83C2*/ u8 boxWallpapers[14]; /*0x83C2*/ u8 boxWallpapers[TOTAL_BOXES_COUNT];
}; };
struct BattleTowerPokemon struct BattleTowerPokemon
+2 -2
View File
@@ -3646,7 +3646,7 @@ static u8 SendMonToPC(struct Pokemon* mon)
do do
{ {
for (boxPos = 0; boxPos < 30; boxPos++) for (boxPos = 0; boxPos < IN_BOX_COUNT; boxPos++)
{ {
struct BoxPokemon* checkingMon = GetBoxedMonPtr(boxNo, boxPos); struct BoxPokemon* checkingMon = GetBoxedMonPtr(boxNo, boxPos);
if (GetBoxMonData(checkingMon, MON_DATA_SPECIES, NULL) == SPECIES_NONE) if (GetBoxMonData(checkingMon, MON_DATA_SPECIES, NULL) == SPECIES_NONE)
@@ -3663,7 +3663,7 @@ static u8 SendMonToPC(struct Pokemon* mon)
} }
boxNo++; boxNo++;
if (boxNo == 14) if (boxNo == TOTAL_BOXES_COUNT)
boxNo = 0; boxNo = 0;
} while (boxNo != StorageGetCurrentBox()); } while (boxNo != StorageGetCurrentBox());