Sort favorites game list by description. (nw)

This commit is contained in:
dankan1890 2016-09-13 20:18:22 +02:00
parent 194cdf6600
commit 953acb3095

View File

@ -549,14 +549,21 @@ void menu_select_game::populate()
}
}
}
// populate favorites list
else
{
// populate favorites list
m_search[0] = '\0';
int curitem = 0;
// sort favorites list by longname (description)
std::multimap<std::string, ui_software_info*> sorted;
for (auto & e : mame_machine_manager::instance()->favorite().m_list)
sorted.emplace(e.longname, &e);
// iterate over entries
for (auto & mfavorite : mame_machine_manager::instance()->favorite().m_list)
for (auto & favmap : sorted)
{
auto &mfavorite = *favmap.second;
auto flags = flags_ui | FLAG_UI_FAVORITE;
if (mfavorite.startempty == 1)
{
@ -993,9 +1000,6 @@ void menu_select_game::inkey_special(const event *menu_event)
void menu_select_game::build_list(const char *filter_text, int filter, bool bioscheck, std::vector<const game_driver *> s_drivers)
{
int cx = 0;
bool cloneof = false;
if (s_drivers.empty())
{
filter = main_filters::actual;
@ -1037,20 +1041,21 @@ void menu_select_game::build_list(const char *filter_text, int filter, bool bios
case FILTER_PARENT:
case FILTER_CLONES:
cloneof = strcmp(s_driver->parent, "0");
if (cloneof)
{
cx = driver_list::find(s_driver->parent);
if (cx != -1 && ((driver_list::driver(cx).flags & MACHINE_IS_BIOS_ROOT) != 0))
cloneof = false;
bool cloneof = strcmp(s_driver->parent, "0");
if (cloneof)
{
auto cx = driver_list::find(s_driver->parent);
if (cx != -1 && ((driver_list::driver(cx).flags & MACHINE_IS_BIOS_ROOT) != 0))
cloneof = false;
}
if (filter == FILTER_CLONES && cloneof)
m_displaylist.push_back(s_driver);
else if (filter == FILTER_PARENT && !cloneof)
m_displaylist.push_back(s_driver);
}
if (filter == FILTER_CLONES && cloneof)
m_displaylist.push_back(s_driver);
else if (filter == FILTER_PARENT && !cloneof)
m_displaylist.push_back(s_driver);
break;
case FILTER_NOT_WORKING:
if (s_driver->flags & MACHINE_NOT_WORKING)
m_displaylist.push_back(s_driver);
@ -1417,11 +1422,10 @@ bool menu_select_game::load_available_machines()
file.gets(rbuf, MAX_CHAR_INFO);
file.gets(rbuf, MAX_CHAR_INFO);
int avsize = 0, unavsize = 0;
file.gets(rbuf, MAX_CHAR_INFO);
avsize = atoi(rbuf);
auto avsize = atoi(rbuf);
file.gets(rbuf, MAX_CHAR_INFO);
unavsize = atoi(rbuf);
auto unavsize = atoi(rbuf);
// load available list
for (int x = 0; x < avsize; ++x)