don't crash with no spoilerfile, fix unknown_get

This commit is contained in:
briaguya 2022-05-27 16:29:49 -04:00
commit 177211611d
2 changed files with 3 additions and 2 deletions

View file

@ -510,6 +510,7 @@ std::unordered_map<std::string, RandomizerGet> SpoilerfileGetNameToEnum = {
void Randomizer::PopulateItemLocations(std::string spoilerFileName) { void Randomizer::PopulateItemLocations(std::string spoilerFileName) {
// todo pull this in from cvar or something // todo pull this in from cvar or something
std::ifstream spoilerFileStream("spoiler.json"); std::ifstream spoilerFileStream("spoiler.json");
if (!spoilerFileStream) return;
json spoilerFileJson; json spoilerFileJson;
spoilerFileStream >> spoilerFileJson; spoilerFileStream >> spoilerFileJson;
json locationsJson = spoilerFileJson["locations"]; json locationsJson = spoilerFileJson["locations"];

View file

@ -278,6 +278,7 @@ typedef enum {
// based on https://github.com/TestRunnerSRL/OoT-Randomizer/blob/e337d7f603b91a6bacb618fb32cc7fd70ed9ffca/ItemList.py // based on https://github.com/TestRunnerSRL/OoT-Randomizer/blob/e337d7f603b91a6bacb618fb32cc7fd70ed9ffca/ItemList.py
typedef enum { typedef enum {
UNKNOWN_GET = 0,
BOMBS_5, BOMBS_5,
DEKU_NUTS_5, DEKU_NUTS_5,
BOMBCHUS_10, BOMBCHUS_10,
@ -499,8 +500,7 @@ typedef enum {
WATER_MEDALLION, WATER_MEDALLION,
SPIRIT_MEDALLION, SPIRIT_MEDALLION,
SHADOW_MEDALLION, SHADOW_MEDALLION,
LIGHT_MEDALLION, LIGHT_MEDALLION
UNKNOWN_GET
} RandomizerGet; } RandomizerGet;
class Randomizer { class Randomizer {