1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-21 14:02:59 +01:00

Refactor scenario sources to C++

This commit is contained in:
Ted John
2016-10-11 20:11:22 +01:00
parent e8e1b702f6
commit b7f7af3123
8 changed files with 406 additions and 329 deletions

View File

@@ -252,7 +252,7 @@ namespace String
size_t newStringSize = ch - firstNonWhitespace;
#if DEBUG
size_t currentStringSize = String::SizeOf(str);
assert(newStringSize < currentStringSize);
Guard::Assert(newStringSize < currentStringSize, GUARD_LINE);
#endif
Memory::Move(str, firstNonWhitespace, newStringSize);
@@ -265,4 +265,25 @@ namespace String
return str;
}
const utf8 * TrimStart(const utf8 * str)
{
codepoint_t codepoint;
const utf8 * ch = str;
const utf8 * nextCh;
while ((codepoint = GetNextCodepoint(ch, &nextCh)) != '\0')
{
if (codepoint <= WCHAR_MAX && !iswspace((wchar_t)codepoint))
{
return ch;
}
ch = nextCh;
}
return str;
}
utf8 * TrimStart(utf8 * buffer, size_t bufferSize, const utf8 * src)
{
return String::Set(buffer, bufferSize, TrimStart(src));
}
}