Skip to content

Commit

Permalink
Review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RipleyTom committed Feb 1, 2024
1 parent 5c88f9a commit 116185c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
14 changes: 4 additions & 10 deletions rpcs3/Emu/NP/np_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1358,17 +1358,10 @@ namespace np
}

const std::string communication_id_str = std::string(basic_handler.context.data);
u32 count = 0;

for (auto it = players_history.begin(); it != players_history.end(); it++)
{
if (it->second.communication_ids.contains(communication_id_str))
return std::count_if(players_history.begin(), players_history.end(), [&](const auto& entry)
{
count++;
}
}

return count;
return entry.second.communication_ids.contains(communication_id_str);
});
}

bool np_handler::get_player_history_entry(u32 options, u32 index, SceNpId* npid)
Expand All @@ -1392,6 +1385,7 @@ namespace np
{
const std::string communication_id_str = std::string(basic_handler.context.data);

// Get the nth element that contains the current communication_id
for (auto it = players_history.begin(); it != players_history.end(); it++)
{
if (it->second.communication_ids.contains(communication_id_str))
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Emu/NP/np_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace np

struct player_history
{
u64 timestamp;
u64 timestamp{};
std::set<std::string> communication_ids;
std::string description;
};
Expand Down
13 changes: 6 additions & 7 deletions rpcs3/rpcs3qt/rpcn_settings_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ namespace np
{
struct player_history
{
u64 timestamp;
u64 timestamp{};
std::set<std::string> communication_ids;
std::string description;
};
Expand Down Expand Up @@ -1068,13 +1068,12 @@ rpcn_friends_dialog::rpcn_friends_dialog(QWidget* parent)
if (!m_rpcn->add_friend(str_sel_friend))
{
QMessageBox::critical(this, tr("Error sending a friend request!"), tr("An error occurred while trying to send a friend request!"), QMessageBox::Ok);
return;
}
else
{
QString qstr_friend = QString::fromStdString(str_sel_friend);
add_update_list(m_lst_requests, qstr_friend, m_orange_icon, QVariant(false));
remove_list(m_lst_history, qstr_friend);
}

QString qstr_friend = QString::fromStdString(str_sel_friend);
add_update_list(m_lst_requests, qstr_friend, m_orange_icon, QVariant(false));
remove_list(m_lst_history, qstr_friend);
});

context_menu->exec(m_lst_history->viewport()->mapToGlobal(pos));
Expand Down

0 comments on commit 116185c

Please sign in to comment.