1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 06:44:38 +01:00

Replace loop with std::find_if

This commit is contained in:
Ted John
2020-04-30 01:54:12 +01:00
parent 297fe537b6
commit f642597098

View File

@@ -671,13 +671,10 @@ NetworkConnection* Network::GetPlayerConnection(uint8_t id)
auto player = GetPlayerByID(id);
if (player != nullptr)
{
for (auto& connection : client_connection_list)
{
if (connection->Player == player)
{
return connection.get();
}
}
return std::find_if(
client_connection_list.begin(), client_connection_list.end(),
[player](const auto& conn) -> bool { return conn->Player == player; })
->get();
}
return nullptr;
}