1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-16 17:02:37 +01:00

Codechange: The compiler ensures static variables are initialised only once, no need to track that manually.

This commit is contained in:
frosch
2025-05-04 19:05:43 +02:00
committed by frosch
parent 75a775e59d
commit b20b6da937
3 changed files with 32 additions and 41 deletions

View File

@@ -2225,11 +2225,11 @@ static void OutputContentState(const ContentInfo &ci)
static bool ConContent(std::span<std::string_view> argv)
{
static ContentCallback *cb = nullptr;
if (cb == nullptr) {
cb = new ConsoleContentCallback();
_network_content_client.AddCallback(cb);
}
[[maybe_unused]] static ContentCallback *const cb = []() {
auto res = new ConsoleContentCallback();
_network_content_client.AddCallback(res);
return res;
}();
if (argv.size() <= 1) {
IConsolePrint(CC_HELP, "Query, select and download content. Usage: 'content update|upgrade|select [id]|unselect [all|id]|state [filter]|download'.");