From 767fee6840d6f768b39371fe021ff8929e6a996c Mon Sep 17 00:00:00 2001 From: Mr_Goldberg Date: Fri, 14 Feb 2020 15:02:54 -0500 Subject: [PATCH] lobby dataupdate is called even when the value does not change. --- dll/steam_matchmaking.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/dll/steam_matchmaking.h b/dll/steam_matchmaking.h index 962e667..36946d0 100644 --- a/dll/steam_matchmaking.h +++ b/dll/steam_matchmaking.h @@ -113,7 +113,7 @@ void send_lobby_data() } } -void trigger_lobby_dataupdate(CSteamID lobby, CSteamID member, bool success, double cb_timeout=0.0) +void trigger_lobby_dataupdate(CSteamID lobby, CSteamID member, bool success, double cb_timeout=0.0, bool send_changed_lobby=true) { PRINT_DEBUG("Lobby dataupdate %llu %llu\n", lobby.ConvertToUint64(), member.ConvertToUint64()); LobbyDataUpdate_t data; @@ -132,10 +132,12 @@ void trigger_lobby_dataupdate(CSteamID lobby, CSteamID member, bool success, dou Lobby *l = get_lobby(lobby); if (l && l->owner() == settings->get_local_steam_id().ConvertToUint64()) { - Common_Message msg = Common_Message(); - msg.set_source_id(settings->get_local_steam_id().ConvertToUint64()); - msg.set_allocated_lobby(new Lobby(*l)); - network->sendToAllIndividuals(&msg, true); + if (send_changed_lobby) { + Common_Message msg = Common_Message(); + msg.set_source_id(settings->get_local_steam_id().ConvertToUint64()); + msg.set_allocated_lobby(new Lobby(*l)); + network->sendToAllIndividuals(&msg, true); + } } } @@ -774,10 +776,9 @@ bool SetLobbyData( CSteamID steamIDLobby, const char *pchKey, const char *pchVal } auto result = lobby->values().find(pchKey); - if (result == lobby->values().end() || result->second != std::string(pchValue)) { - (*lobby->mutable_values())[pchKey] = pchValue; - trigger_lobby_dataupdate(steamIDLobby, steamIDLobby, true); - } + bool changed = (result == lobby->values().end()) || (result->second != std::string(pchValue)); + (*lobby->mutable_values())[pchKey] = pchValue; + trigger_lobby_dataupdate(steamIDLobby, steamIDLobby, true, 0.0, changed); return true; }