mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2024-11-23 12:28:07 +01:00
More accurate SetLobbyData.
This commit is contained in:
parent
7e1824290a
commit
802d8bcc8f
1 changed files with 10 additions and 7 deletions
|
@ -809,18 +809,21 @@ bool SetLobbyData( CSteamID steamIDLobby, const char *pchKey, const char *pchVal
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
|
||||||
Lobby *lobby = get_lobby(steamIDLobby);
|
Lobby *lobby = get_lobby(steamIDLobby);
|
||||||
if (!lobby || lobby->owner() != settings->get_local_steam_id().ConvertToUint64() || lobby->deleted()) {
|
if (!lobby || lobby->deleted()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto result = caseinsensitive_find(lobby->values(), pchKey);
|
|
||||||
bool changed = true;
|
bool changed = true;
|
||||||
|
//callback is always triggered when setlobbydata is called from non owner however no data is actually changed.
|
||||||
|
if (lobby->owner() == settings->get_local_steam_id().ConvertToUint64()) {
|
||||||
|
auto result = caseinsensitive_find(lobby->values(), pchKey);
|
||||||
if (result == lobby->values().end()) {
|
if (result == lobby->values().end()) {
|
||||||
(*lobby->mutable_values())[pchKey] = pchValue;
|
(*lobby->mutable_values())[pchKey] = pchValue;
|
||||||
} else {
|
} else {
|
||||||
if (result->second == std::string(pchValue)) changed = false;
|
if (result->second == std::string(pchValue)) changed = false;
|
||||||
(*lobby->mutable_values())[result->first] = pchValue;
|
(*lobby->mutable_values())[result->first] = pchValue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (changed)
|
if (changed)
|
||||||
trigger_lobby_dataupdate(steamIDLobby, steamIDLobby, true, 0.005, changed);
|
trigger_lobby_dataupdate(steamIDLobby, steamIDLobby, true, 0.005, changed);
|
||||||
|
|
Loading…
Reference in a new issue