Make lobby ids more like the ones on steam.

This commit is contained in:
Mr_Goldberg 2022-05-21 00:37:48 -04:00
parent a88739a753
commit 6d5cb3181f
No known key found for this signature in database
GPG Key ID: 8597D87419DEF278
2 changed files with 7 additions and 5 deletions

View File

@ -138,7 +138,7 @@ CSteamID generate_steam_id_anonserver()
CSteamID generate_steam_id_lobby()
{
return CSteamID(generate_account_id(), k_unSteamUserDefaultInstance | k_EChatInstanceFlagLobby, k_EUniversePublic, k_EAccountTypeChat);
return CSteamID(generate_account_id(), k_EChatInstanceFlagLobby | k_EChatInstanceFlagMMSLobby, k_EUniversePublic, k_EAccountTypeChat);
}
bool check_timedout(std::chrono::high_resolution_clock::time_point old, double timeout)

View File

@ -107,7 +107,10 @@ google::protobuf::Map<std::string,std::string>::const_iterator caseinsensitive_f
Lobby *get_lobby(CSteamID id)
{
auto lobby = std::find_if(lobbies.begin(), lobbies.end(), [&id](Lobby const& item) { return item.room_id() == id.ConvertToUint64(); });
if (!id.IsLobby())
return NULL;
auto lobby = std::find_if(lobbies.begin(), lobbies.end(), [&id](Lobby const& item) { return (item.room_id() & 0xFFFFFFFF) == (id.GetAccountID()); });
if (lobbies.end() == lobby)
return NULL;
@ -653,8 +656,8 @@ void LeaveLobby( CSteamID steamIDLobby )
PRINT_DEBUG("LeaveLobby\n");
std::lock_guard<std::recursive_mutex> lock(global_mutex);
PRINT_DEBUG("LeaveLobby pass mutex\n");
auto lobby = std::find_if(lobbies.begin(), lobbies.end(), [&steamIDLobby](Lobby const& item) { return item.room_id() == steamIDLobby.ConvertToUint64(); });
if (lobbies.end() != lobby) {
Lobby *lobby = get_lobby(steamIDLobby);
if (lobby) {
if (!lobby->deleted()) {
on_self_enter_leave_lobby((uint64)lobby->room_id(), lobby->type(), true);
self_lobby_member_data.erase(lobby->room_id());
@ -677,7 +680,6 @@ void LeaveLobby( CSteamID steamIDLobby )
send_clients_packet(steamIDLobby, message);
lobby->set_deleted(true);
lobby->set_time_deleted(std::chrono::duration_cast<std::chrono::duration<uint64>>(std::chrono::system_clock::now().time_since_epoch()).count());
//lobbies.erase(lobby);
}
}
}