mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-30 10:15:36 +01:00
fix #1908
This commit is contained in:
@@ -41,13 +41,27 @@ public:
|
||||
*/
|
||||
void Append(const utf8 *text) {
|
||||
int textLength = strlen(text);
|
||||
Append(text, textLength);
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends the given string of the given length to the current string. Essentially used to ignore null terminators or copy
|
||||
* the data faster as the length is already known.
|
||||
*/
|
||||
void Append(const utf8 *text, int textLength) {
|
||||
EnsureCapacity(_length + textLength + 1);
|
||||
Memory::Copy(_buffer + _length, text, textLength);
|
||||
_length += textLength;
|
||||
_buffer[_length] = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends the string of a given StringBuilder to the current string.
|
||||
*/
|
||||
void Append(const StringBuilder *sb) {
|
||||
Append(sb->GetBuffer(), sb->GetLength());
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the current string, but preserves the allocated memory for another string.
|
||||
*/
|
||||
|
||||
@@ -445,7 +445,7 @@ void LanguagePack::ParseString(IStringReader *reader)
|
||||
}
|
||||
}
|
||||
|
||||
_stringDataSB.Append(sb.GetBuffer());
|
||||
_stringDataSB.Append(&sb);
|
||||
}
|
||||
|
||||
bool LanguagePack::ParseToken(IStringReader *reader, uint32 *token)
|
||||
@@ -469,5 +469,14 @@ bool LanguagePack::ParseToken(IStringReader *reader, uint32 *token)
|
||||
|
||||
const utf8 *tokenName = sb.GetBuffer();
|
||||
*token = format_get_code(tokenName);
|
||||
|
||||
// Handle explicit byte values
|
||||
if (*token == 0) {
|
||||
int number;
|
||||
if (sscanf(tokenName, "%d", &number) == 1) {
|
||||
*token = Math::Clamp(0, number, 255);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user