aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlaise <[email protected]>2019-09-01 15:51:44 -0500
committerFlaise <[email protected]>2019-09-01 15:51:44 -0500
commit248986d2a67cd23a88658d473ae8f5cae7d9663d (patch)
tree2c8739e0208be551e962e93c17623224468b6430
parentSteamError is Copy and Clone, adjusted callback type constraints (diff)
downloadsteamworks-rs-248986d2a67cd23a88658d473ae8f5cae7d9663d.tar.xz
steamworks-rs-248986d2a67cd23a88658d473ae8f5cae7d9663d.zip
Binding for SetLobbyJoinable, FriendState derivations, small documentation adjustments
-rw-r--r--src/friends.rs7
-rw-r--r--src/matchmaking.rs17
-rw-r--r--steamworks-sys/src/lib.rs1
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 <Manager> Friend<Manager> {
}
}
- /// 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<Vec<u8>> {
unsafe {
let utils = sys::steam_rust_get_utils();
@@ -253,7 +252,7 @@ impl <Manager> Friend<Manager> {
}
}
- /// 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<Vec<u8>> {
unsafe {
let utils = sys::steam_rust_get_utils();
@@ -277,7 +276,7 @@ impl <Manager> Friend<Manager> {
}
}
-#[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 <Manager> Matchmaking<Manager> {
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;