diff options
| author | Philip Dubé <159546+serprex@users.noreply.github.com> | 2026-07-12 17:51:55 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-12 17:51:55 +0000 |
| commit | ba08197d3b54d33edd02cf682eaaaf85522f7c86 (patch) | |
| tree | d76fcab04c054e5d539ff62bac13d38d68aa57a8 | |
| parent | a44197712ca241148f71bba838493bc8258bf9cf (diff) | |
Avoid double line break when revealing MQness of spirit temple (#6912)
| -rw-r--r-- | soh/soh/Enhancements/custom-message/CustomMessageManager.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/soh/soh/Enhancements/custom-message/CustomMessageManager.cpp b/soh/soh/Enhancements/custom-message/CustomMessageManager.cpp index 0b3fb17cf..b52ee24cc 100644 --- a/soh/soh/Enhancements/custom-message/CustomMessageManager.cpp +++ b/soh/soh/Enhancements/custom-message/CustomMessageManager.cpp @@ -506,7 +506,10 @@ size_t CustomMessage::FindNEWLINE(std::string& str, size_t lastNewline) const { bool CustomMessage::AddBreakString(std::string& str, size_t pos, std::string breakString) const { if (str[pos] == ' ' || str[pos] == '&') { - str.replace(pos, 1, breakString); + // don't add a break next to an existing newline + if (str[pos] != ' ' || (str[pos + 1] != '&' && str[pos + 1] != NEWLINE()[0])) { + str.replace(pos, 1, breakString); + } return false; } else { if (pos <= str.size() - 1) { @@ -515,7 +518,10 @@ bool CustomMessage::AddBreakString(std::string& str, size_t pos, std::string bre return false; // otherwise, if it is a line break or space, replace it } else if (str[pos + 1] == ' ' || str[pos + 1] == '&') { - str.replace(pos + 1, 1, breakString); + // don't add a break next to an existing newline + if (str[pos + 1] != ' ' || (str[pos + 2] != '&' && str[pos + 2] != NEWLINE()[0])) { + str.replace(pos + 1, 1, breakString); + } return false; } } |
