mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-23 06:35:33 -07:00
every time
This commit is contained in:
parent
7d2a2cdee4
commit
af0566f1b7
1 changed files with 18 additions and 18 deletions
|
@ -470,11 +470,11 @@ size_t CustomMessage::FindNEWLINE(std::string& str, size_t lastNewline) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CustomMessage::AddBreakString(std::string& str, size_t pos, std::string breakString) const {
|
bool CustomMessage::AddBreakString(std::string& str, size_t pos, std::string breakString) const {
|
||||||
if (str[pos] == (char)" " || str[pos] == (char)"&"){
|
if (str[pos] == (char)" " || str[pos] == (char)"&") {
|
||||||
str.replace(pos, 1, breakString);
|
str.replace(pos, 1, breakString);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
str.insert(pos+1, breakString);
|
str.insert(pos + 1, breakString);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -523,14 +523,14 @@ void CustomMessage::AutoFormatString(std::string& str) const {
|
||||||
lineCount = 0;
|
lineCount = 0;
|
||||||
// some lines need to be split but don't have spaces, look for periods instead
|
// some lines need to be split but don't have spaces, look for periods instead
|
||||||
} else {
|
} else {
|
||||||
const size_t lastBreak = str.find_last_of((std::string)".,!- ", lastNewline + lineLength);
|
const size_t lastBreak = str.find_last_of((std::string) ".,!- ", lastNewline + lineLength);
|
||||||
//if none exist or we go backwards, we look forward for a something and allow the overflow
|
// if none exist or we go backwards, we look forward for a something and allow the overflow
|
||||||
if (lastBreak == std::string::npos || lastBreak < lastNewline){
|
if (lastBreak == std::string::npos || lastBreak < lastNewline) {
|
||||||
const size_t nextBreak = str.find_first_of((std::string)".,!- &^", lastNewline);
|
const size_t nextBreak = str.find_first_of((std::string) ".,!- &^", lastNewline);
|
||||||
if (str[nextBreak] == (char)"^"){
|
if (str[nextBreak] == (char)"^") {
|
||||||
lastNewline = nextBreak + 1;
|
lastNewline = nextBreak + 1;
|
||||||
lineCount = 0; //increments to 1 at the end
|
lineCount = 0; // increments to 1 at the end
|
||||||
} else if (str[nextBreak] == (char)"&"){
|
} else if (str[nextBreak] == (char)"&") {
|
||||||
lastNewline = nextBreak + 1;
|
lastNewline = nextBreak + 1;
|
||||||
} else {
|
} else {
|
||||||
bool isAdded = AddBreakString(str, nextBreak, "&");
|
bool isAdded = AddBreakString(str, nextBreak, "&");
|
||||||
|
@ -558,11 +558,11 @@ void CustomMessage::AutoFormatString(std::string& str) const {
|
||||||
lastNewline = carrot + 1;
|
lastNewline = carrot + 1;
|
||||||
// some lines need to be split but don't have spaces, look for punctuation instead
|
// some lines need to be split but don't have spaces, look for punctuation instead
|
||||||
} else {
|
} else {
|
||||||
const size_t lastBreak = str.find_last_of((std::string)".,!- &", lastNewline + lineLength);
|
const size_t lastBreak = str.find_last_of((std::string) ".,!- &", lastNewline + lineLength);
|
||||||
//if none exist or we go backwards, we look forward for a something and allow the overflow
|
// if none exist or we go backwards, we look forward for a something and allow the overflow
|
||||||
if (lastBreak == std::string::npos || lastBreak < lastNewline){
|
if (lastBreak == std::string::npos || lastBreak < lastNewline) {
|
||||||
const size_t nextBreak = str.find_first_of((std::string)".,!- &^", lastNewline);
|
const size_t nextBreak = str.find_first_of((std::string) ".,!- &^", lastNewline);
|
||||||
if (str[nextBreak] == (char)"^"){
|
if (str[nextBreak] == (char)"^") {
|
||||||
lastNewline = nextBreak + 1;
|
lastNewline = nextBreak + 1;
|
||||||
} else {
|
} else {
|
||||||
bool isAdded = AddBreakString(str, nextBreak, "^" + colorText);
|
bool isAdded = AddBreakString(str, nextBreak, "^" + colorText);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue