1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-19 20:49:11 +00:00

Codechange: replace C-style strings with C++-style strings in textfile (#10772)

This commit is contained in:
Patric Stout
2023-05-09 21:35:50 +02:00
committed by GitHub
parent 90529ea48b
commit febe394806
7 changed files with 63 additions and 53 deletions

View File

@@ -2103,9 +2103,13 @@ bool MissingGlyphSearcher::FindMissingGlyphs()
}
this->Reset();
for (const char *text = this->NextString(); text != nullptr; text = this->NextString()) {
for (auto text = this->NextString(); text.has_value(); text = this->NextString()) {
auto src = text->cbegin();
FontSize size = this->DefaultSize();
for (WChar c = Utf8Consume(&text); c != '\0'; c = Utf8Consume(&text)) {
while (src != text->cend()) {
WChar c = Utf8Consume(src);
if (c >= SCC_FIRST_FONT && c <= SCC_LAST_FONT) {
size = (FontSize)(c - SCC_FIRST_FONT);
} else if (!IsInsideMM(c, SCC_SPRITE_START, SCC_SPRITE_END) && IsPrintable(c) && !IsTextDirectionChar(c) && c != '?' && GetGlyph(size, c) == question_mark[size]) {
@@ -2144,9 +2148,9 @@ class LanguagePackGlyphSearcher : public MissingGlyphSearcher {
return FS_NORMAL;
}
const char *NextString() override
std::optional<std::string_view> NextString() override
{
if (this->i >= TEXT_TAB_END) return nullptr;
if (this->i >= TEXT_TAB_END) return std::nullopt;
const char *ret = _langpack.offsets[_langpack.langtab_start[this->i] + this->j];