playerCount() cannot be greater than LINK_UNIVERSAL_MAX_PLAYERS

This commit is contained in:
Rodrigo Alfonso
2025-01-30 06:28:41 -03:00
parent eb8ce2d3fe
commit 9fb91309b6

View File

@@ -197,8 +197,9 @@ class LinkUniversal {
* @brief Returns the number of connected players (`1~5`).
*/
[[nodiscard]] u8 playerCount() {
return mode == Mode::LINK_CABLE ? linkCable.playerCount()
: linkWireless.playerCount();
return Link::_min(mode == Mode::LINK_CABLE ? linkCable.playerCount()
: linkWireless.playerCount(),
LINK_UNIVERSAL_MAX_PLAYERS);
}
/**