(nw) Removed duplicates from list of approximate software matches.

This commit is contained in:
Robbbert 2017-05-21 23:22:19 +10:00
parent 3ad2d8f34f
commit 3b3ef88bfe

View File

@ -155,6 +155,16 @@ void software_list_device::find_approx_matches(const std::string &name, int matc
int shortpenalty = driver_list::penalty_compare(name.c_str(), swinfo.shortname().c_str());
int curpenalty = std::min(longpenalty, shortpenalty);
// make sure it isn't already in the table
bool skip = false;
for (int matchnum = 0; matchnum < matches; matchnum++)
{
if ((penalty[matchnum] == curpenalty) && (swinfo.longname() == list[matchnum]->longname()) && (swinfo.shortname() == list[matchnum]->shortname()))
skip = true;
}
if (!skip)
{
// insert into the sorted table of matches
for (int matchnum = matches - 1; matchnum >= 0; matchnum--)
{
@ -175,6 +185,7 @@ void software_list_device::find_approx_matches(const std::string &name, int matc
}
}
}
}
//-------------------------------------------------