PlayerDB Delete Untrusted Players (#3053)
This commit is contained in:
parent
d75bebd386
commit
f4449bad99
@ -219,6 +219,33 @@ namespace big
|
|||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void player_database_service::remove_untrusted_players()
|
||||||
|
{
|
||||||
|
for (auto it = m_players.begin(); it != m_players.end();)
|
||||||
|
{
|
||||||
|
if (!it->second->is_trusted)
|
||||||
|
{
|
||||||
|
it = m_players.erase(it);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto it = m_sorted_players.begin(); it != m_sorted_players.end();)
|
||||||
|
{
|
||||||
|
if (!it->second->is_trusted)
|
||||||
|
{
|
||||||
|
it = m_sorted_players.erase(it);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<persistent_player> player_database_service::get_player_by_rockstar_id(uint64_t rockstar_id)
|
std::shared_ptr<persistent_player> player_database_service::get_player_by_rockstar_id(uint64_t rockstar_id)
|
||||||
{
|
{
|
||||||
if (m_players.contains(rockstar_id))
|
if (m_players.contains(rockstar_id))
|
||||||
|
@ -47,6 +47,7 @@ namespace big
|
|||||||
std::map<std::string, std::shared_ptr<persistent_player>>& get_sorted_players();
|
std::map<std::string, std::shared_ptr<persistent_player>>& get_sorted_players();
|
||||||
std::shared_ptr<persistent_player> get_player_by_rockstar_id(uint64_t rockstar_id);
|
std::shared_ptr<persistent_player> get_player_by_rockstar_id(uint64_t rockstar_id);
|
||||||
std::shared_ptr<persistent_player> get_or_create_player(player_ptr player);
|
std::shared_ptr<persistent_player> get_or_create_player(player_ptr player);
|
||||||
|
void remove_untrusted_players();
|
||||||
void update_rockstar_id(uint64_t old, uint64_t _new);
|
void update_rockstar_id(uint64_t old, uint64_t _new);
|
||||||
void remove_rockstar_id(uint64_t rockstar_id);
|
void remove_rockstar_id(uint64_t rockstar_id);
|
||||||
|
|
||||||
|
@ -281,6 +281,33 @@ namespace big
|
|||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ImGui::Button("REMOVE_UNTRUSTED"_T.data()))
|
||||||
|
{
|
||||||
|
ImGui::OpenPopup("##removeuntrusted");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::BeginPopupModal("##removeuntrusted"))
|
||||||
|
{
|
||||||
|
ImGui::Text("VIEW_NET_PLAYER_DB_ARE_YOU_SURE"_T.data());
|
||||||
|
|
||||||
|
if (ImGui::Button("YES"_T.data()))
|
||||||
|
{
|
||||||
|
g_player_database_service->set_selected(nullptr);
|
||||||
|
g_player_database_service->remove_untrusted_players();
|
||||||
|
g_player_database_service->save();
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button("NO"_T.data()))
|
||||||
|
{
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::EndPopup();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::SameLine();
|
||||||
|
|
||||||
if (ImGui::Button("REMOVE_ALL"_T.data()))
|
if (ImGui::Button("REMOVE_ALL"_T.data()))
|
||||||
{
|
{
|
||||||
ImGui::OpenPopup("##removeall");
|
ImGui::OpenPopup("##removeall");
|
||||||
@ -307,8 +334,6 @@ namespace big
|
|||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SameLine();
|
|
||||||
|
|
||||||
components::button("RELOAD_PLYR_ONLINE_STATES"_T, [] {
|
components::button("RELOAD_PLYR_ONLINE_STATES"_T, [] {
|
||||||
g_player_database_service->update_player_states();
|
g_player_database_service->update_player_states();
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user