From 248986d2a67cd23a88658d473ae8f5cae7d9663d Mon Sep 17 00:00:00 2001 From: Flaise Date: Sun, 1 Sep 2019 15:51:44 -0500 Subject: Binding for SetLobbyJoinable, FriendState derivations, small documentation adjustments --- src/friends.rs | 7 +++---- src/matchmaking.rs | 17 +++++++++++++++++ steamworks-sys/src/lib.rs | 1 + 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/friends.rs b/src/friends.rs index b7a12f0..1958258 100644 --- a/src/friends.rs +++ b/src/friends.rs @@ -1,4 +1,3 @@ - use super::*; use std::net::Ipv4Addr; @@ -230,7 +229,7 @@ impl Friend { } } - /// Returns a small (32x32) avatar for the user + /// Returns a small (32x32) avatar for the user in RGBA format pub fn small_avatar(&self) -> Option> { unsafe { let utils = sys::steam_rust_get_utils(); @@ -253,7 +252,7 @@ impl Friend { } } - /// Returns a small (64x64) avatar for the user + /// Returns a medium (64x64) avatar for the user in RGBA format pub fn medium_avatar(&self) -> Option> { unsafe { let utils = sys::steam_rust_get_utils(); @@ -277,7 +276,7 @@ impl Friend { } } -#[derive(Clone, Copy, Debug)] +#[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum FriendState { Offline, Online, diff --git a/src/matchmaking.rs b/src/matchmaking.rs index 30e4fa1..f10eff1 100644 --- a/src/matchmaking.rs +++ b/src/matchmaking.rs @@ -168,6 +168,23 @@ impl Matchmaking { members } } + + /// Sets whether or not a lobby is joinable by other players. This always defaults to enabled + /// for a new lobby. + /// + /// If joining is disabled, then no players can join, even if they are a friend or have been + /// invited. + /// + /// Lobbies with joining disabled will not be returned from a lobby search. + /// + /// Returns true on success, false if the current user doesn't own the lobby. + pub fn set_lobby_joinable(&self, lobby: LobbyId, joinable: bool) -> bool { + unsafe { + sys::SteamAPI_ISteamMatchmaking_SetLobbyJoinable( + self.mm, sys::CSteamID(lobby.0), joinable + ) != 0 + } + } } #[test] diff --git a/steamworks-sys/src/lib.rs b/steamworks-sys/src/lib.rs index 18d8ecf..c15b77b 100644 --- a/steamworks-sys/src/lib.rs +++ b/steamworks-sys/src/lib.rs @@ -141,6 +141,7 @@ extern "C" { pub fn SteamAPI_ISteamMatchmaking_GetLobbyOwner(instance: *mut ISteamMatchmaking, lobby: CSteamID) -> CSteamID; pub fn SteamAPI_ISteamMatchmaking_GetNumLobbyMembers(instance: *mut ISteamMatchmaking, lobby: CSteamID) -> c_int; pub fn SteamAPI_ISteamMatchmaking_GetLobbyMemberByIndex(instance: *mut ISteamMatchmaking, lobby: CSteamID, member: c_int) -> CSteamID; + pub fn SteamAPI_ISteamMatchmaking_SetLobbyJoinable(instance: *mut ISteamMatchmaking, lobby: CSteamID, lobbyJoinable: bool) -> u8; pub fn SteamAPI_ISteamNetworking_AcceptP2PSessionWithUser(instance: *mut ISteamNetworking, remote: CSteamID) -> u8; pub fn SteamAPI_ISteamNetworking_CloseP2PSessionWithUser(instance: *mut ISteamNetworking, remote: CSteamID) -> u8; -- cgit v1.2.3