GUI: U32: Improve u32 in all engine subsystems

- Common: add wordWrap function to ustr.cpp
- Bladerunner: Explicitly state we have a U32String in subs (same as Subtitles::loadOuttakeSubsText)
- Don't use translations for engine specific "put strings", because they might not support.
- SCI: Use const references for showScummVMDialog
- SCUMM:
-- Don't use translation in md5 warning. left comments with the translated version.
-- Remove some redundant headers in help.cpp
-- Don't use translation in handleSaveload when printing to console
-- Also, display success transaction correctly via u32::format
- TESTBED: Use fake constructor when setting label of button
- SKY: Correctly use translation when using SaveStateDescription
- ULTIMA: Don't use translations when display_string
- ENGINES:
-- GenerateUnknownGameReport correctly, with proper translations.
-- There was an error, where a function had been declared twice, in a header file. Correct this.
This commit is contained in:
aryanrawlani28 2020-07-21 04:24:04 +05:30 committed by Eugene Sandulenko
parent 68d01321d6
commit 12e4f871a3
25 changed files with 107 additions and 58 deletions

View file

@ -496,6 +496,44 @@ U32String operator+(const U32String &x, const U32String &y) {
return temp;
}
void U32String::wordWrap(const uint32 maxLength) {
if (_size < maxLength) {
return;
}
makeUnique();
const uint32 kNoSpace = 0xFFFFFFFF;
uint32 i = 0;
while (i < _size) {
uint32 lastSpace = kNoSpace;
uint32 x = 0;
while (i < _size && x <= maxLength) {
const char c = _str[i];
if (c == '\n') {
lastSpace = kNoSpace;
x = 0;
} else {
if (Common::isSpace(c)) {
lastSpace = i;
}
++x;
}
++i;
}
if (x > maxLength) {
if (lastSpace == kNoSpace) {
insertChar('\n', i - 1);
} else {
setChar('\n', lastSpace);
i = lastSpace + 1;
}
}
}
}
uint64 U32String::asUint64() const {
uint64 result = 0;
for (uint32 i = 0; i < _size; ++i) {