diff --git a/src/services/player_database/player_database_service.cpp b/src/services/player_database/player_database_service.cpp index b64b1ba0..ed1b780b 100644 --- a/src/services/player_database/player_database_service.cpp +++ b/src/services/player_database/player_database_service.cpp @@ -33,7 +33,7 @@ namespace big if (!player.notify_online) return; - if (g.player_db.notify_when_joinable && !is_joinable_session(player.session_type) && is_joinable_session(new_session_type)) + if (g.player_db.notify_when_joinable && !is_joinable_session(player.session_type, player.game_mode) && is_joinable_session(new_session_type, player.game_mode)) { g_notification_service.push_success("Player DB", std::format("{} is now in a joinable session", player.name)); } @@ -41,7 +41,7 @@ namespace big { g_notification_service.push_success("Player DB", std::format("{} is now online", player.name)); } - else if (g.player_db.notify_when_unjoinable && is_joinable_session(player.session_type) && !is_joinable_session(new_session_type) && new_session_type != GSType::Invalid) + else if (g.player_db.notify_when_unjoinable && is_joinable_session(player.session_type, player.game_mode) && !is_joinable_session(new_session_type, player.game_mode) && new_session_type != GSType::Invalid) { g_notification_service.push("Player DB", std::format("{} is no longer in a joinable session", player.name)); } @@ -101,8 +101,7 @@ namespace big for (auto& player : m_players) { - if (player.second->join_redirect && is_joinable_session(player.second->session_type) - && current_preference_level < player.second->join_redirect_preference) + if (player.second->join_redirect && is_joinable_session(player.second->session_type, player.second->game_mode)) { current_preference_level = player.second->join_redirect_preference; preferred_session = player.second->redirect_info; @@ -528,9 +527,9 @@ namespace big } } - bool player_database_service::is_joinable_session(GSType type) + bool player_database_service::is_joinable_session(GSType type, GameMode mode) { - return type == GSType::Public || type == GSType::OpenCrew; + return (type == GSType::Public || type == GSType::OpenCrew) && !can_fetch_name(mode); } const char* player_database_service::get_session_type_str(GSType type) diff --git a/src/services/player_database/player_database_service.hpp b/src/services/player_database/player_database_service.hpp index 8ccea2fc..2dd7aa92 100644 --- a/src/services/player_database/player_database_service.hpp +++ b/src/services/player_database/player_database_service.hpp @@ -57,7 +57,7 @@ namespace big void start_update_loop(); void update_player_states(bool tracked_only = false); - static bool is_joinable_session(GSType type); + static bool is_joinable_session(GSType type, GameMode mode); static const char* get_session_type_str(GSType type); static const char* get_game_mode_str(GameMode mode); static bool can_fetch_name(GameMode mode); diff --git a/src/views/network/view_player_database.cpp b/src/views/network/view_player_database.cpp index 4d6fea7c..74c54976 100644 --- a/src/views/network/view_player_database.cpp +++ b/src/views/network/view_player_database.cpp @@ -25,7 +25,7 @@ namespace big return ImVec4(.5f, .5f, .5f, 1.0f); else if (player.session_type == GSType::Invalid) return ImVec4(1.f, 0.f, 0.f, 1.f); - else if (!player_database_service::is_joinable_session(player.session_type)) + else if (!player_database_service::is_joinable_session(player.session_type, player.game_mode)) return ImVec4(1.f, 1.f, 0.f, 1.f); else return ImVec4(0.f, 1.f, 0.f, 1.f); @@ -100,13 +100,13 @@ namespace big for (auto& player : item_arr | std::ranges::views::values) { - if (player_database_service::is_joinable_session(player->session_type)) + if (player_database_service::is_joinable_session(player->session_type, player->game_mode)) draw_player_db_entry(player, lower_search); } for (auto& player : item_arr | std::ranges::views::values) { - if (!player_database_service::is_joinable_session(player->session_type) && player->session_type != GSType::Invalid + if (!player_database_service::is_joinable_session(player->session_type, player->game_mode) && player->session_type != GSType::Invalid && player->session_type != GSType::Unknown) draw_player_db_entry(player, lower_search); } @@ -228,9 +228,14 @@ namespace big ImGui::SliderInt("VIEW_NET_PLAYER_DB_PREFERENCE"_T.data(), ¤t_player->join_redirect_preference, 1, 10); } + bool joinable = + player_database_service::is_joinable_session(current_player->session_type, current_player->game_mode); + + ImGui::BeginDisabled(!joinable); components::button("JOIN_SESSION"_T, [] { session::join_by_rockstar_id(current_player->rockstar_id); }); + ImGui::EndDisabled(); ImGui::SameLine();