Skip to content

Commit

Permalink
Exposes FormatCustomMessage and uses it in FormatJsonHintText.
Browse files Browse the repository at this point in the history
  • Loading branch information
leggettc18 committed Aug 2, 2022
1 parent eae97cf commit 480053d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
4 changes: 2 additions & 2 deletions soh/soh/Enhancements/custom_message/CustomMessageManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ class CustomMessageManager {

void ReplaceSpecialCharacters(std::string &string);
void ReplaceColors(std::string& string);
void FormatCustomMessage(std::string& message, ItemID iid);
void FormatCustomMessage(std::string& message);
bool InsertCustomMessage(std::string tableID, uint16_t textID, CustomMessageEntry messages);

std::string MESSAGE_END();
Expand All @@ -91,4 +89,6 @@ class CustomMessageManager {
CustomMessageEntry RetrieveMessage(std::string tableID, uint16_t textID);
bool ClearMessageTable(std::string tableID);
bool AddCustomMessageTable(std::string tableID);
void FormatCustomMessage(std::string& message, ItemID iid);
void FormatCustomMessage(std::string& message);
};
19 changes: 1 addition & 18 deletions soh/soh/Enhancements/randomizer/randomizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1826,24 +1826,7 @@ std::string AltarIconString(char iconChar) {
std::string FormatJsonHintText(std::string jsonHint) {
std::string formattedHintMessage = jsonHint;

std::unordered_map<std::string, char> textBoxSpecialCharacters = {
{ "À", 0x80 }, { "î", 0x81 }, { "Â", 0x82 }, { "Ä", 0x83 }, { "Ç", 0x84 }, { "È", 0x85 }, { "É", 0x86 },
{ "Ê", 0x87 }, { "Ë", 0x88 }, { "Ï", 0x89 }, { "Ô", 0x8A }, { "Ö", 0x8B }, { "Ù", 0x8C }, { "Û", 0x8D },
{ "Ü", 0x8E }, { "ß", 0x8F }, { "à", 0x90 }, { "á", 0x91 }, { "â", 0x92 }, { "ä", 0x93 }, { "ç", 0x94 },
{ "è", 0x95 }, { "é", 0x96 }, { "ê", 0x97 }, { "ë", 0x98 }, { "ï", 0x99 }, { "ô", 0x9A }, { "ö", 0x9B },
{ "ù", 0x9C }, { "û", 0x9D }, { "ü", 0x9E }
};

// add special characters
for (auto specialCharacterPair : textBoxSpecialCharacters) {
size_t start_pos = 0;
std::string textBoxSpecialCharacterString = "";
textBoxSpecialCharacterString += specialCharacterPair.second;
while ((start_pos = formattedHintMessage.find(specialCharacterPair.first, start_pos)) != std::string::npos) {
formattedHintMessage.replace(start_pos, specialCharacterPair.first.length(), textBoxSpecialCharacterString);
start_pos += textBoxSpecialCharacterString.length();
}
}
CustomMessageManager::Instance->FormatCustomMessage(formattedHintMessage);

// add icons to altar text
for (char iconChar : {'0', '1', '2', '3', '4', '5', '6', '7', '8', 'o', 'c', 'i', 'l', 'b', 'L', 'k'}) {
Expand Down

0 comments on commit 480053d

Please sign in to comment.