MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / advanceToNextLineWrapped

Function advanceToNextLineWrapped

src/OpenLoco/src/Graphics/TextRenderer.cpp:397–427  ·  view source on GitHub ↗

Use only with buffer mangled by wrapString

Source from the content-addressed store, hash-verified

395
396 // Use only with buffer mangled by wrapString
397 static const char* advanceToNextLineWrapped(const char* str)
398 {
399 // Traverse the buffer for the next line
400 const char* ptr = str;
401 while (true)
402 {
403 const auto chr = static_cast<uint8_t>(*ptr++);
404 if (chr == 0U)
405 {
406 return ptr;
407 }
408
409 if (chr >= ControlCodes::oneArgBegin && chr < ControlCodes::oneArgEnd)
410 {
411 // Skip argument
412 ptr++;
413 }
414 else if (chr >= ControlCodes::twoArgBegin && chr < ControlCodes::twoArgEnd)
415 {
416 // Skip argument
417 ptr += 2;
418 }
419 else if (chr >= ControlCodes::fourArgBegin && chr < ControlCodes::fourArgEnd)
420 {
421 // Skip argument
422 ptr += 4;
423 }
424 }
425
426 return nullptr;
427 }
428
429 // 0x00495224
430 // al: colour

Callers 4

drawStringLeftWrappedFunction · 0.85
drawStringCentredWrappedFunction · 0.85
drawStringCentredRawFunction · 0.85
drawStringTickerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected