mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-28 08:39:49 -06:00
Merge pull request #13093 from mitaclaw/ranges-modernization-4-projection
Ranges Algorithms Modernization - Projection
This commit is contained in:
@ -1540,9 +1540,7 @@ void NetPlayClient::DisplayPlayersPing()
|
||||
|
||||
u32 NetPlayClient::GetPlayersMaxPing() const
|
||||
{
|
||||
return std::max_element(
|
||||
m_players.begin(), m_players.end(),
|
||||
[](const auto& a, const auto& b) { return a.second.ping < b.second.ping; })
|
||||
return std::ranges::max_element(m_players, {}, [](const auto& kv) { return kv.second.ping; })
|
||||
->second.ping;
|
||||
}
|
||||
|
||||
@ -2409,22 +2407,14 @@ bool NetPlayClient::IsFirstInGamePad(int ingame_pad) const
|
||||
[](auto mapping) { return mapping > 0; });
|
||||
}
|
||||
|
||||
static int CountLocalPads(const PadMappingArray& pad_map, const PlayerId& local_player_pid)
|
||||
{
|
||||
return static_cast<int>(
|
||||
std::count_if(pad_map.begin(), pad_map.end(), [&local_player_pid](const auto& mapping) {
|
||||
return mapping == local_player_pid;
|
||||
}));
|
||||
}
|
||||
|
||||
int NetPlayClient::NumLocalPads() const
|
||||
{
|
||||
return CountLocalPads(m_pad_map, m_local_player->pid);
|
||||
return std::ranges::count(m_pad_map, m_local_player->pid);
|
||||
}
|
||||
|
||||
int NetPlayClient::NumLocalWiimotes() const
|
||||
{
|
||||
return CountLocalPads(m_wiimote_map, m_local_player->pid);
|
||||
return std::ranges::count(m_wiimote_map, m_local_player->pid);
|
||||
}
|
||||
|
||||
static int InGameToLocal(int ingame_pad, const PadMappingArray& pad_map, PlayerId local_player_pid)
|
||||
|
Reference in New Issue
Block a user