Skip to content

Commit

Permalink
Fix issue with item name replacement at runtime. (#4068)
Browse files Browse the repository at this point in the history
  • Loading branch information
leggettc18 authored Apr 23, 2024
1 parent 39e6269 commit 99fbecd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
13 changes: 11 additions & 2 deletions soh/soh/Enhancements/randomizer/randomizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();

Expand Down
3 changes: 0 additions & 3 deletions soh/soh/Enhancements/randomizer/randomizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<RandomizerGet, std::array<std::string, 3>> EnumToSpoilerfileGetName;

static Sprite* GetSeedTexture(uint8_t index);
bool SpoilerFileExists(const char* spoilerFileName);
void LoadMerchantMessages();
Expand Down

0 comments on commit 99fbecd

Please sign in to comment.