mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-01 13:48:56 +00:00
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:
parent
03f8ec09eb
commit
fa7c969e15
3 changed files with 15 additions and 30 deletions
|
@ -614,17 +614,15 @@ std::unique_ptr<Cheats::CheatSearchSessionBase> Cheats::CheatSearchSession<T>::C
|
|||
|
||||
template <typename T>
|
||||
std::unique_ptr<Cheats::CheatSearchSessionBase>
|
||||
Cheats::CheatSearchSession<T>::ClonePartial(const std::vector<size_t>& result_indices) const
|
||||
Cheats::CheatSearchSession<T>::ClonePartial(const size_t begin_index, const size_t end_index) const
|
||||
{
|
||||
const auto& results = m_search_results;
|
||||
std::vector<SearchResult<T>> partial_results;
|
||||
partial_results.reserve(result_indices.size());
|
||||
for (size_t idx : result_indices)
|
||||
partial_results.push_back(results[idx]);
|
||||
if (begin_index == 0 && end_index >= m_search_results.size())
|
||||
return Clone();
|
||||
|
||||
auto c =
|
||||
std::make_unique<Cheats::CheatSearchSession<T>>(m_memory_ranges, m_address_space, m_aligned);
|
||||
c->m_search_results = std::move(partial_results);
|
||||
c->m_search_results.assign(m_search_results.begin() + begin_index,
|
||||
m_search_results.begin() + end_index);
|
||||
c->m_compare_type = this->m_compare_type;
|
||||
c->m_filter_type = this->m_filter_type;
|
||||
c->m_value = this->m_value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue