mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-26 16:15:19 -07:00
Add in a way to AutoFormat with an item icon.
This commit is contained in:
parent
feaa821ac3
commit
a513a422b0
2 changed files with 11 additions and 2 deletions
|
@ -353,6 +353,14 @@ void CustomMessage::AutoFormat() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CustomMessage::AutoFormat(ItemID iid) {
|
||||||
|
for (std::string &str : messages) {
|
||||||
|
str.insert(0, ITEM_OBTAINED(iid));
|
||||||
|
}
|
||||||
|
AutoFormat();
|
||||||
|
Replace(WAIT_FOR_INPUT(), WAIT_FOR_INPUT() + ITEM_OBTAINED(iid));
|
||||||
|
}
|
||||||
|
|
||||||
void CustomMessage::Clean() {
|
void CustomMessage::Clean() {
|
||||||
for (std::string& str : messages) {
|
for (std::string& str : messages) {
|
||||||
CleanString(str);
|
CleanString(str);
|
||||||
|
@ -408,7 +416,7 @@ static size_t NextLineLength(const std::string* textStr, const size_t lastNewlin
|
||||||
// Skip over control codes
|
// Skip over control codes
|
||||||
if (textStr->at(currentPos) == '%') {
|
if (textStr->at(currentPos) == '%') {
|
||||||
nextPosJump = 2;
|
nextPosJump = 2;
|
||||||
} else if (textStr->at(currentPos) == '$') {
|
} else if (textStr->at(currentPos) == '\x13') {
|
||||||
nextPosJump = 2;
|
nextPosJump = 2;
|
||||||
} else if (textStr->at(currentPos) == '@') {
|
} else if (textStr->at(currentPos) == '@') {
|
||||||
nextPosJump = 1;
|
nextPosJump = 1;
|
||||||
|
@ -512,7 +520,7 @@ void CustomMessage::AutoFormatString(std::string& str) const {
|
||||||
ReplaceColors(str);
|
ReplaceColors(str);
|
||||||
// insert newlines either manually or when encountering a '&'
|
// insert newlines either manually or when encountering a '&'
|
||||||
size_t lastNewline = 0;
|
size_t lastNewline = 0;
|
||||||
const bool hasIcon = str.find('$', 0) != std::string::npos;
|
const bool hasIcon = str.find('\x13') != std::string::npos;
|
||||||
size_t lineLength = NextLineLength(&str, lastNewline, hasIcon);
|
size_t lineLength = NextLineLength(&str, lastNewline, hasIcon);
|
||||||
size_t lineCount = 1;
|
size_t lineCount = 1;
|
||||||
size_t yesNo = str.find("\x1B"s[0], lastNewline);
|
size_t yesNo = str.find("\x1B"s[0], lastNewline);
|
||||||
|
|
|
@ -163,6 +163,7 @@ class CustomMessage {
|
||||||
* textboxes, and use it's formatting.
|
* textboxes, and use it's formatting.
|
||||||
*/
|
*/
|
||||||
void AutoFormat();
|
void AutoFormat();
|
||||||
|
void AutoFormat(ItemID iid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Removes all OoT formatting from the message,
|
* @brief Removes all OoT formatting from the message,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue