V0 #2

Closed
RusticMaple wants to merge 58 commits from v0 into main
Showing only changes of commit 4de04a4627 - Show all commits

fix checking if a session has active players

Maple Nebel 2025-11-08 17:19:28 +00:00

View file

@ -240,17 +240,21 @@ impl ExtendedMatchmakeSession{
}).await; }).await;
} }
} }
pub fn has_active_players(&self) -> bool{
self.connected_players.iter().filter(|v| v.upgrade().is_some()).count() != 0
}
#[inline] #[inline]
pub fn is_reachable(&self) -> bool{ pub fn is_reachable(&self) -> bool{
(if self.session.gathering.flags & PERSISTENT_GATHERING != 0{ (if self.session.gathering.flags & PERSISTENT_GATHERING != 0{
if !self.connected_players.is_empty(){ if self.has_active_players(){
true true
} else { } else {
self.session.open_participation self.session.open_participation
} }
} else { } else {
!self.connected_players.is_empty() !self.has_active_players()
}) & !self.connected_players.is_empty() }) & !self.has_active_players()
} }
#[inline] #[inline]
pub fn is_joinable(&self) -> bool{ pub fn is_joinable(&self) -> bool{