mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2024-11-23 20:38:07 +01:00
Make lobby ids more like the ones on steam.
This commit is contained in:
parent
a88739a753
commit
6d5cb3181f
2 changed files with 7 additions and 5 deletions
|
@ -138,7 +138,7 @@ CSteamID generate_steam_id_anonserver()
|
||||||
|
|
||||||
CSteamID generate_steam_id_lobby()
|
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)
|
bool check_timedout(std::chrono::high_resolution_clock::time_point old, double timeout)
|
||||||
|
|
|
@ -107,7 +107,10 @@ google::protobuf::Map<std::string,std::string>::const_iterator caseinsensitive_f
|
||||||
|
|
||||||
Lobby *get_lobby(CSteamID id)
|
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)
|
if (lobbies.end() == lobby)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -653,8 +656,8 @@ void LeaveLobby( CSteamID steamIDLobby )
|
||||||
PRINT_DEBUG("LeaveLobby\n");
|
PRINT_DEBUG("LeaveLobby\n");
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
PRINT_DEBUG("LeaveLobby pass mutex\n");
|
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(); });
|
Lobby *lobby = get_lobby(steamIDLobby);
|
||||||
if (lobbies.end() != lobby) {
|
if (lobby) {
|
||||||
if (!lobby->deleted()) {
|
if (!lobby->deleted()) {
|
||||||
on_self_enter_leave_lobby((uint64)lobby->room_id(), lobby->type(), true);
|
on_self_enter_leave_lobby((uint64)lobby->room_id(), lobby->type(), true);
|
||||||
self_lobby_member_data.erase(lobby->room_id());
|
self_lobby_member_data.erase(lobby->room_id());
|
||||||
|
@ -677,7 +680,6 @@ void LeaveLobby( CSteamID steamIDLobby )
|
||||||
send_clients_packet(steamIDLobby, message);
|
send_clients_packet(steamIDLobby, message);
|
||||||
lobby->set_deleted(true);
|
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());
|
lobby->set_time_deleted(std::chrono::duration_cast<std::chrono::duration<uint64>>(std::chrono::system_clock::now().time_since_epoch()).count());
|
||||||
//lobbies.erase(lobby);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue