CheatSearch: Use index range for ClonePartial

Specify the begin and end indices instead of filling a vector with all
the indices which are continuous anyway.
This commit is contained in:
Dentomologist
2023-10-26 13:06:16 -07:00
parent 03f8ec09eb
commit fa7c969e15
3 changed files with 15 additions and 30 deletions

View File

@ -373,28 +373,15 @@ void CheatSearchWidget::OnNextScanClicked()
bool CheatSearchWidget::RefreshValues()
{
const size_t result_count = m_session->GetResultCount();
if (result_count == 0)
const size_t displayed_result_count = std::min(TABLE_MAX_ROWS, m_session->GetResultCount());
if (displayed_result_count == 0)
{
m_info_label_1->setText(tr("Cannot refresh without results."));
return false;
}
const bool too_many_results = result_count > TABLE_MAX_ROWS;
std::unique_ptr<Cheats::CheatSearchSessionBase> tmp;
if (too_many_results)
{
std::vector<size_t> value_indices;
value_indices.reserve(TABLE_MAX_ROWS);
for (size_t i = 0; i < TABLE_MAX_ROWS; ++i)
value_indices.push_back(i);
tmp = m_session->ClonePartial(value_indices);
}
else
{
tmp = m_session->Clone();
}
std::unique_ptr<Cheats::CheatSearchSessionBase> tmp =
m_session->ClonePartial(0, displayed_result_count);
tmp->SetFilterType(Cheats::FilterType::DoNotFilter);
const Cheats::SearchErrorCode error_code = [&tmp] {