diff options
| author | Alex Parrill <[email protected]> | 2019-06-05 22:28:05 -0400 |
|---|---|---|
| committer | Matthew Collins <[email protected]> | 2019-06-09 23:50:11 +0100 |
| commit | 1db54ed7e950f227fb323d0a9a8783477603811b (patch) | |
| tree | 13de67354cab9784f9b188d75ad49a5e20048181 | |
| parent | Add Utils::set_warning_callback for logging Steam warnings (diff) | |
| download | steamworks-rs-1db54ed7e950f227fb323d0a9a8783477603811b.tar.xz steamworks-rs-1db54ed7e950f227fb323d0a9a8783477603811b.zip | |
Add SteamId::account_id to get the account ID
The account ID is used in a few places in the API.
| -rw-r--r-- | src/lib.rs | 7 | ||||
| -rw-r--r-- | steamworks-sys/src/lib.cpp | 6 | ||||
| -rw-r--r-- | steamworks-sys/src/lib.rs | 1 |
3 files changed, 14 insertions, 0 deletions
@@ -345,6 +345,13 @@ impl SteamId { sys::steam_rust_is_steam_id_valid(self.0) != 0 } } + + /// Returns the account id for this steam id + pub fn account_id(&self) -> u32 { + unsafe { + sys::steam_rust_get_account_id_from_steam_id(self.0).0 + } + } } /// A game id diff --git a/steamworks-sys/src/lib.cpp b/steamworks-sys/src/lib.cpp index 51664a6..2c5860d 100644 --- a/steamworks-sys/src/lib.cpp +++ b/steamworks-sys/src/lib.cpp @@ -76,6 +76,12 @@ extern "C" { return id.AppID(); } + AccountID_t steam_rust_get_account_id_from_steam_id(uint64_t steam_id) { + CSteamID id; + id.SetFromUint64(steam_id); + return id.GetAccountID(); + } + ISteamClient* steam_rust_get_client() { return SteamClient(); } ISteamMatchmaking* steam_rust_get_matchmaking() { return SteamMatchmaking(); } ISteamNetworking* steam_rust_get_networking() { return SteamNetworking(); } diff --git a/steamworks-sys/src/lib.rs b/steamworks-sys/src/lib.rs index f32b784..f90257d 100644 --- a/steamworks-sys/src/lib.rs +++ b/steamworks-sys/src/lib.rs @@ -74,6 +74,7 @@ extern "C" { pub fn steam_rust_is_game_id_valid(id: u64) -> c_int; pub fn steam_rust_get_game_id_mod(id: u64) -> u32; pub fn steam_rust_get_game_id_app(id: u64) -> u32; + pub fn steam_rust_get_account_id_from_steam_id(steam_id: u64) -> AccountID_t; // |