From db9e1d9be659a270c455d868b1c3b0458bb7adcc Mon Sep 17 00:00:00 2001 From: ymo4 <41833771+ymo-4@users.noreply.github.com> Date: Sun, 30 Jun 2024 02:18:03 +0300 Subject: [PATCH 1/2] add set_game_tags --- src/server.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/server.rs b/src/server.rs index 5fe2a08..1ac2035 100644 --- a/src/server.rs +++ b/src/server.rs @@ -353,6 +353,26 @@ impl Server { } } + /// Sets a string defining the "gametags" for this server, this is optional, but if set it + /// allows users to filter in the matchmaking/server-browser interfaces based on the value. + /// + /// This is usually formatted as a comma or semicolon separated list. + /// + /// Don't set this unless it actually changes, its only uploaded to the master once; + /// when acknowledged. + /// + /// The new "gametags" value to set. Must not be an empty string (""). + /// This can not be longer than 127. + pub fn set_game_tags(&self, tags: &str) { + assert!(tags.len() == 0, "tags must not be an empty string (\"\")."); + assert!(tags.len() > 127, "tags can not be longer than 127."); + + let tags = CString::new(tags).unwrap(); + unsafe { + sys::SteamAPI_ISteamGameServer_SetGameTags(self.server, tags.as_ptr()); + } + } + /// Returns an accessor to the steam UGC interface (steam workshop) /// /// **For this to work properly, you need to call `UGC::init_for_game_server()`!** From 62ceafbb713d7d38750a1f0208e75631438533b1 Mon Sep 17 00:00:00 2001 From: ymo4 <41833771+ymo-4@users.noreply.github.com> Date: Thu, 18 Jul 2024 18:16:52 +0300 Subject: [PATCH 2/2] fix asserts in set_game_tags --- src/server.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server.rs b/src/server.rs index 1ac2035..d67da49 100644 --- a/src/server.rs +++ b/src/server.rs @@ -364,8 +364,8 @@ impl Server { /// The new "gametags" value to set. Must not be an empty string (""). /// This can not be longer than 127. pub fn set_game_tags(&self, tags: &str) { - assert!(tags.len() == 0, "tags must not be an empty string (\"\")."); - assert!(tags.len() > 127, "tags can not be longer than 127."); + assert!(tags.len() != 0, "tags must not be an empty string (\"\")."); + assert!(tags.len() < 128, "tags can not be longer than 127."); let tags = CString::new(tags).unwrap(); unsafe {