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:
committed by
Peter Nelson
parent
7b31f26611
commit
20d83677eb
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user