1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2025-12-10 06:52:05 +01:00

Codefix: Use of nullptr instead of std::nullopt. (#14590)

This commit is contained in:
Peter Nelson
2025-09-05 14:05:02 +01:00
committed by GitHub
parent 122023be8d
commit a2f3d59707
2 changed files with 2 additions and 2 deletions

View File

@@ -407,7 +407,7 @@ std::optional<std::string> GetCurrentLocale(const char *)
if (GetLocaleInfoA(userUiLocale, LOCALE_SISO639LANGNAME, lang, static_cast<int>(std::size(lang))) == 0 ||
GetLocaleInfoA(userUiLocale, LOCALE_SISO3166CTRYNAME, country, static_cast<int>(std::size(country))) == 0) {
/* Unable to retrieve the locale. */
return nullptr;
return std::nullopt;
}
/* Format it as 'en_us'. */
return fmt::format("{}_{}", std::string_view{lang, 2}, std::string_view{country, 2});

View File

@@ -401,7 +401,7 @@ void CocoaDialog(std::string_view title, std::string_view message, std::string_v
bool wasstarted = _cocoa_video_started;
if (VideoDriver::GetInstance() == nullptr) {
CocoaSetupApplication(); // Setup application before showing dialog
} else if (!_cocoa_video_started && VideoDriver::GetInstance()->Start({}) != nullptr) {
} else if (!_cocoa_video_started && VideoDriver::GetInstance()->Start({}).has_value()) {
fmt::print(stderr, "{}: {}\n", title, message);
return;
}