Use correct type for unlock IDs in loading

This commit is contained in:
Eidolon 2024-03-09 12:20:16 -06:00
parent 1b3c63f24a
commit 49f644d5e9
2 changed files with 3 additions and 10 deletions

View file

@ -483,15 +483,8 @@ void srb2::load_ng_gamedata()
PU_STATIC, NULL));
for (size_t i = 0; i < std::min((size_t)(gamedata->challengegridwidth * CHALLENGEGRIDHEIGHT), js.challengegrid.grid.size()); i++)
{
int16_t gridvalue = js.challengegrid.grid[i];
if (gridvalue < 0)
{
gamedata->challengegrid[i] = MAXUNLOCKABLES;
}
else
{
gamedata->challengegrid[i] = static_cast<uint8_t>(gridvalue);
}
uint16_t gridvalue = js.challengegrid.grid[i];
gamedata->challengegrid[i] = gridvalue;
}
M_SanitiseChallengeGrid();

View file

@ -98,7 +98,7 @@ struct GamedataPrisonEggPickupsJson final
struct GamedataChallengeGridJson final
{
uint32_t width;
std::vector<int16_t> grid;
std::vector<uint16_t> grid;
NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(GamedataChallengeGridJson, width, grid)
};