1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-17 01:12:39 +01:00

Codechange: Use unique_ptr to manage ContentInfo lifetime.

Removes manually managed new/delete.
This commit is contained in:
Peter Nelson
2025-04-10 08:34:59 +01:00
committed by Peter Nelson
parent 7b31f26611
commit 20d83677eb
5 changed files with 52 additions and 78 deletions

View File

@@ -2171,9 +2171,9 @@ DEF_CONSOLE_CMD(ConContent)
if (argc <= 2) {
/* List selected content */
IConsolePrint(CC_WHITE, "id, type, state, name");
for (ConstContentIterator iter = _network_content_client.Begin(); iter != _network_content_client.End(); iter++) {
if ((*iter)->state != ContentInfo::SELECTED && (*iter)->state != ContentInfo::AUTOSELECTED) continue;
OutputContentState(**iter);
for (const ContentInfo &ci : _network_content_client.Info()) {
if (ci.state != ContentInfo::SELECTED && ci.state != ContentInfo::AUTOSELECTED) continue;
OutputContentState(ci);
}
} else if (StrEqualsIgnoreCase(argv[2], "all")) {
/* The intention of this function was that you could download
@@ -2204,9 +2204,9 @@ DEF_CONSOLE_CMD(ConContent)
if (StrEqualsIgnoreCase(argv[1], "state")) {
IConsolePrint(CC_WHITE, "id, type, state, name");
for (ConstContentIterator iter = _network_content_client.Begin(); iter != _network_content_client.End(); iter++) {
if (argc > 2 && !StrContainsIgnoreCase((*iter)->name, argv[2])) continue;
OutputContentState(**iter);
for (const ContentInfo &ci : _network_content_client.Info()) {
if (argc > 2 && !StrContainsIgnoreCase(ci.name, argv[2])) continue;
OutputContentState(ci);
}
return true;
}