Refactor message handling and improve message editor functionality

- Combined TextCommands and SpecialChars into a single vector for streamlined matching in FindMatchingElement.
- Removed unnecessary logging in ParseMessageToData for cleaner error handling.
- Updated FindRealDictionaryEntry function signature for improved readability.
- Enhanced DrawCurrentMessage to strip newline characters from input before parsing.
- Added command parameter input in DrawTextCommands for better user interaction.
- Cleaned up unused ToString methods in MessageData and TextElement structures.
This commit is contained in:
scawful
2025-05-10 12:52:34 -04:00
parent f75830c06c
commit ce6cde438c
6 changed files with 33 additions and 32 deletions

View File

@@ -83,8 +83,8 @@ constexpr uint8_t kLine3 = 0x76;
std::vector<DictionaryEntry> BuildDictionaryEntries(Rom *rom);
std::string ReplaceAllDictionaryWords(std::string str,
std::vector<DictionaryEntry> dictionary);
DictionaryEntry FindRealDictionaryEntry(uint8_t value,
std::vector<DictionaryEntry> dictionary);
DictionaryEntry FindRealDictionaryEntry(
uint8_t value, std::vector<DictionaryEntry> dictionary);
// Inserted into commands to protect them from dictionary replacements.
const std::string CHEESE = "\uBEBE";
@@ -119,10 +119,6 @@ struct MessageData {
ContentsParsed = other.ContentsParsed;
}
std::string ToString() const {
return absl::StrFormat("%0X - %s", ID, ContentsParsed);
}
std::string OptimizeMessageForDictionary(
std::string message_string,
const std::vector<DictionaryEntry> &dictionary) {
@@ -197,10 +193,6 @@ struct TextElement {
}
}
std::string ToString() const {
return absl::StrFormat("%s %s", GenericToken, Description);
}
std::smatch MatchMe(std::string dfrag) const {
std::regex pattern(StrictPattern);
std::smatch match;