Fix issue with item name replacement at runtime. (#4068)

This commit is contained in:
Christopher Leggett 2024-04-23 12:30:30 -04:00 committed by GitHub
parent 39e6269731
commit 99fbecd951
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 5 deletions

View File

@ -2613,7 +2613,11 @@ CustomMessage Randomizer::ReplaceWithItemName(CustomMessage message, std::string
ctx->overrides[hintedCheck].GetTrickName().english ctx->overrides[hintedCheck].GetTrickName().english
}; };
} else { } else {
itemName = EnumToSpoilerfileGetName[targetRG]; itemName = {
Rando::StaticData::RetrieveItem(targetRG).GetName().english,
Rando::StaticData::RetrieveItem(targetRG).GetName().french,
Rando::StaticData::RetrieveItem(targetRG).GetName().english,
};
} }
message.Replace(std::move(toReplace), std::move(itemName[0]), std::move(itemName[1]), std::move(itemName[2])); message.Replace(std::move(toReplace), std::move(itemName[0]), std::move(itemName[1]), std::move(itemName[2]));
return message; return message;
@ -2745,7 +2749,12 @@ CustomMessage Randomizer::GetMerchantMessage(RandomizerInf randomizerInf, u16 te
std::string(ctx->overrides[rc].GetTrickName().english) std::string(ctx->overrides[rc].GetTrickName().english)
}; };
} else { } else {
shopItemName = EnumToSpoilerfileGetName[shopItemGet]; auto shopItem = Rando::StaticData::RetrieveItem(shopItemGet);
shopItemName = {
shopItem.GetName().english,
shopItem.GetName().french,
shopItem.GetName().english,
};
} }
u16 shopItemPrice = ctx->GetItemLocation(rc)->GetPrice(); u16 shopItemPrice = ctx->GetItemLocation(rc)->GetPrice();

View File

@ -39,9 +39,6 @@ class Randomizer {
static const std::string IceTrapRandoMessageTableID; static const std::string IceTrapRandoMessageTableID;
static const std::string randoMiscHintsTableID; static const std::string randoMiscHintsTableID;
// Public for now to be accessed by SaveManager, will be made private again soon :tm:
std::unordered_map<RandomizerGet, std::array<std::string, 3>> EnumToSpoilerfileGetName;
static Sprite* GetSeedTexture(uint8_t index); static Sprite* GetSeedTexture(uint8_t index);
bool SpoilerFileExists(const char* spoilerFileName); bool SpoilerFileExists(const char* spoilerFileName);
void LoadMerchantMessages(); void LoadMerchantMessages();