From 99fbecd951bfd0710ccbd14ac8086b965ea1e143 Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Tue, 23 Apr 2024 12:30:30 -0400 Subject: [PATCH] Fix issue with item name replacement at runtime. (#4068) --- soh/soh/Enhancements/randomizer/randomizer.cpp | 13 +++++++++++-- soh/soh/Enhancements/randomizer/randomizer.h | 3 --- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 1a4d21f7d..99d8961a5 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -2613,7 +2613,11 @@ CustomMessage Randomizer::ReplaceWithItemName(CustomMessage message, std::string ctx->overrides[hintedCheck].GetTrickName().english }; } 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])); return message; @@ -2745,7 +2749,12 @@ CustomMessage Randomizer::GetMerchantMessage(RandomizerInf randomizerInf, u16 te std::string(ctx->overrides[rc].GetTrickName().english) }; } 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(); diff --git a/soh/soh/Enhancements/randomizer/randomizer.h b/soh/soh/Enhancements/randomizer/randomizer.h index 4d5a2ff30..5f567cd54 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.h +++ b/soh/soh/Enhancements/randomizer/randomizer.h @@ -39,9 +39,6 @@ class Randomizer { static const std::string IceTrapRandoMessageTableID; static const std::string randoMiscHintsTableID; - // Public for now to be accessed by SaveManager, will be made private again soon :tm: - std::unordered_map> EnumToSpoilerfileGetName; - static Sprite* GetSeedTexture(uint8_t index); bool SpoilerFileExists(const char* spoilerFileName); void LoadMerchantMessages();