mirror of
https://github.com/pret/pokeplatinum.git
synced 2026-04-25 07:29:01 -05:00
Streamlined sFossilItemToSpeciesMapping expandability (#886)
This commit is contained in:
parent
e7c9da4c9f
commit
b3f2b4d2d2
|
|
@ -14,7 +14,7 @@
|
|||
static const struct {
|
||||
u16 item;
|
||||
u16 species;
|
||||
} sFossilItemToSpeciesMapping[7] = {
|
||||
} sFossilItemToSpeciesMapping[] = {
|
||||
{ .item = ITEM_OLD_AMBER, .species = SPECIES_AERODACTYL },
|
||||
{ .item = ITEM_HELIX_FOSSIL, .species = SPECIES_OMANYTE },
|
||||
{ .item = ITEM_DOME_FOSSIL, .species = SPECIES_KABUTO },
|
||||
|
|
@ -30,7 +30,7 @@ BOOL ScrCmd_GetFossilCount(ScriptContext *ctx)
|
|||
u16 totalCount;
|
||||
u16 *destVar = ScriptContext_GetVarPointer(ctx);
|
||||
|
||||
for (i = 0, totalCount = 0; i < 7; i++) {
|
||||
for (i = 0, totalCount = 0; i < NELEMS(sFossilItemToSpeciesMapping); i++) {
|
||||
totalCount += Bag_GetItemQuantity(SaveData_GetBag(fieldSystem->saveData), sFossilItemToSpeciesMapping[i].item, HEAP_ID_FIELD1);
|
||||
}
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ BOOL ScrCmd_GetSpeciesFromFossil(ScriptContext *ctx)
|
|||
|
||||
*destVar = 0;
|
||||
|
||||
for (i = 0; i < 7; i++) {
|
||||
for (i = 0; i < NELEMS(sFossilItemToSpeciesMapping); i++) {
|
||||
if (sFossilItemToSpeciesMapping[i].item == inputItemID) {
|
||||
*destVar = sFossilItemToSpeciesMapping[i].species;
|
||||
break;
|
||||
|
|
@ -69,7 +69,7 @@ BOOL ScrCmd_FindFossilAtThreshold(ScriptContext *ctx)
|
|||
*outItemID = 0;
|
||||
*outIndex = 0;
|
||||
|
||||
for (i = 0, currentCount = 0; i < 7; i++) {
|
||||
for (i = 0, currentCount = 0; i < NELEMS(sFossilItemToSpeciesMapping); i++) {
|
||||
currentCount += Bag_GetItemQuantity(SaveData_GetBag(fieldSystem->saveData), sFossilItemToSpeciesMapping[i].item, HEAP_ID_FIELD1);
|
||||
|
||||
if (currentCount >= threshold) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user