mirror of https://github.com/OpenRCT2/OpenRCT2.git
Replace loop with std::find_if
This commit is contained in:
parent
297fe537b6
commit
f642597098
|
@ -671,13 +671,10 @@ NetworkConnection* Network::GetPlayerConnection(uint8_t id)
|
||||||
auto player = GetPlayerByID(id);
|
auto player = GetPlayerByID(id);
|
||||||
if (player != nullptr)
|
if (player != nullptr)
|
||||||
{
|
{
|
||||||
for (auto& connection : client_connection_list)
|
return std::find_if(
|
||||||
{
|
client_connection_list.begin(), client_connection_list.end(),
|
||||||
if (connection->Player == player)
|
[player](const auto& conn) -> bool { return conn->Player == player; })
|
||||||
{
|
->get();
|
||||||
return connection.get();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue