mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2024-11-10 06:38:34 +01:00
Set lobby member data should be available right away to getlobbymemberdata
This commit is contained in:
parent
c279a5c9a8
commit
33cdf77c77
1 changed files with 19 additions and 5 deletions
|
@ -88,6 +88,7 @@ public ISteamMatchmaking
|
||||||
std::vector<struct Chat_Entry> chat_entries;
|
std::vector<struct Chat_Entry> chat_entries;
|
||||||
std::vector<struct Data_Requested> data_requested;
|
std::vector<struct Data_Requested> data_requested;
|
||||||
|
|
||||||
|
std::map<uint64, std::map<std::string, std::string>> self_lobby_member_data;
|
||||||
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(); });
|
auto lobby = std::find_if(lobbies.begin(), lobbies.end(), [&id](Lobby const& item) { return item.room_id() == id.ConvertToUint64(); });
|
||||||
|
@ -239,6 +240,7 @@ void remove_lobbies()
|
||||||
while (g != std::end(lobbies)) {
|
while (g != std::end(lobbies)) {
|
||||||
if (g->members().size() == 0 || (g->deleted() && (g->time_deleted() + LOBBY_DELETED_TIMEOUT < current_time))) {
|
if (g->members().size() == 0 || (g->deleted() && (g->time_deleted() + LOBBY_DELETED_TIMEOUT < current_time))) {
|
||||||
PRINT_DEBUG("REMOVING LOBBY %llu\n", g->room_id());
|
PRINT_DEBUG("REMOVING LOBBY %llu\n", g->room_id());
|
||||||
|
self_lobby_member_data.erase(g->room_id());
|
||||||
g = lobbies.erase(g);
|
g = lobbies.erase(g);
|
||||||
} else {
|
} else {
|
||||||
++g;
|
++g;
|
||||||
|
@ -846,13 +848,22 @@ const char *GetLobbyMemberData( CSteamID steamIDLobby, CSteamID steamIDUser, con
|
||||||
struct Lobby_Member *member = get_lobby_member(get_lobby(steamIDLobby), steamIDUser);
|
struct Lobby_Member *member = get_lobby_member(get_lobby(steamIDLobby), steamIDUser);
|
||||||
const char *ret = "";
|
const char *ret = "";
|
||||||
if (member) {
|
if (member) {
|
||||||
|
if (steamIDUser == settings->get_local_steam_id()) {
|
||||||
|
auto result = self_lobby_member_data.find(steamIDLobby.ConvertToUint64());
|
||||||
|
if (result != self_lobby_member_data.end()) {
|
||||||
|
auto value = result->second.find(std::string(pchKey));
|
||||||
|
if (value != result->second.end()) {
|
||||||
|
ret = value->second.c_str();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
auto result = member->values().find(std::string(pchKey));
|
auto result = member->values().find(std::string(pchKey));
|
||||||
if (result == member->values().end()) return "";
|
if (result == member->values().end()) return "";
|
||||||
PRINT_DEBUG("GetLobbyMemberData res %s\n", result->second.c_str());
|
|
||||||
ret = result->second.c_str();
|
ret = result->second.c_str();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PRINT_DEBUG("GetLobbyMemberData res %s\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -879,6 +890,8 @@ void SetLobbyMemberData( CSteamID steamIDLobby, const char *pchKey, const char *
|
||||||
(*message->mutable_map())[pchKey] = pchValue;
|
(*message->mutable_map())[pchKey] = pchValue;
|
||||||
send_owner_packet(steamIDLobby, message);
|
send_owner_packet(steamIDLobby, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self_lobby_member_data[steamIDLobby.ConvertToUint64()][pchKey] = pchValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1343,6 +1356,7 @@ void Callback(Common_Message *msg)
|
||||||
Lobby_Member *member = get_lobby_member(lobby, (uint64)msg->source_id());
|
Lobby_Member *member = get_lobby_member(lobby, (uint64)msg->source_id());
|
||||||
if (member) {
|
if (member) {
|
||||||
for (auto const &p : msg->lobby_messages().map()) {
|
for (auto const &p : msg->lobby_messages().map()) {
|
||||||
|
PRINT_DEBUG("member data %s:%s\n", p.first.c_str(), p.second.c_str());
|
||||||
(*member->mutable_values())[p.first] = p.second;
|
(*member->mutable_values())[p.first] = p.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue