underground: add price table size asserts (#990)

This commit is contained in:
Thomas Kolarik 2026-03-08 01:15:41 -05:00 committed by GitHub
parent 5156a26a83
commit 1e10ad9f65
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -8,7 +8,6 @@
#include "underground/defs.h"
// TODO: make this error if it doesn't contain an entry for every trap
static const SpherePrice sTrapPrices[] = {
[TRAP_NONE] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[TRAP_MOVE_UP] = { .sphereType = SPHERE_BLUE, .minSize = 3, .maxSize = 6 },
@ -45,6 +44,7 @@ static const SpherePrice sTrapPrices[] = {
[TRAP_RADAR_DUMMY] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[TRAP_DIGGER_DRILL] = { .sphereType = RANDOM_SPHERE_TYPE, .minSize = 15, .maxSize = 20 }
};
SDK_COMPILER_ASSERT(NELEMS(sTrapPrices) == TRAP_MAX);
// params need to be const to match
const u8 Trap_GetSpherePriceType(const enum Trap trapID)

View File

@ -8,7 +8,6 @@
#include "underground/defs.h"
#include "underground/mining.h"
// TODO: make this error if it doesn't contain an entry for every treasure
static const SpherePrice sTreasurePrices[] = {
[MINING_TREASURE_NONE] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
[MINING_SMALL_PRISM_SPHERE] = { .sphereType = SPHERE_NONE, .minSize = 0, .maxSize = 0 },
@ -71,6 +70,7 @@ static const SpherePrice sTreasurePrices[] = {
[MINING_TREASURE_DREAD_PLATE] = { .sphereType = SPHERE_RED, .minSize = 70, .maxSize = 80 },
[MINING_TREASURE_IRON_PLATE] = { .sphereType = SPHERE_PRISM, .minSize = 70, .maxSize = 80 }
};
SDK_COMPILER_ASSERT(NELEMS(sTreasurePrices) == MINING_TREASURE_MAX);
u8 Treasure_GetSpherePriceType(int treasureID)
{