|
|
@ -954,6 +954,7 @@ public:
|
|
|
|
viewscreen_unitprofessionset(vector<UnitInfo*> &base_units,
|
|
|
|
viewscreen_unitprofessionset(vector<UnitInfo*> &base_units,
|
|
|
|
bool filter_selected = true
|
|
|
|
bool filter_selected = true
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
:menu_options(-1) // default
|
|
|
|
{
|
|
|
|
{
|
|
|
|
menu_options.multiselect = false;
|
|
|
|
menu_options.multiselect = false;
|
|
|
|
menu_options.auto_select = true;
|
|
|
|
menu_options.auto_select = true;
|
|
|
@ -967,7 +968,7 @@ public:
|
|
|
|
std::string name = manager.templates[i].name;
|
|
|
|
std::string name = manager.templates[i].name;
|
|
|
|
if (manager.templates[i].mask)
|
|
|
|
if (manager.templates[i].mask)
|
|
|
|
name += " (mask)";
|
|
|
|
name += " (mask)";
|
|
|
|
ListEntry<size_t> elem(name, i+1);
|
|
|
|
ListEntry<size_t> elem(name, i);
|
|
|
|
menu_options.add(elem);
|
|
|
|
menu_options.add(elem);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
menu_options.filterDisplay();
|
|
|
|
menu_options.filterDisplay();
|
|
|
@ -1001,20 +1002,22 @@ public:
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (events->count(interface_key::SELECT))
|
|
|
|
if (events->count(interface_key::SELECT))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
select_profession(menu_options.getFirstSelectedElem());
|
|
|
|
if (menu_options.hasSelection())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
select_profession(menu_options.getFirstSelectedElem());
|
|
|
|
|
|
|
|
}
|
|
|
|
Screen::dismiss(this);
|
|
|
|
Screen::dismiss(this);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void select_profession(size_t selected)
|
|
|
|
void select_profession(size_t selected)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (selected > manager.templates.size())
|
|
|
|
if (manager.templates.empty() || selected >= manager.templates.size())
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
ProfessionTemplate prof = manager.templates[selected - 1];
|
|
|
|
ProfessionTemplate prof = manager.templates[selected];
|
|
|
|
|
|
|
|
|
|
|
|
for (auto it = units.begin(); it != units.end(); ++it)
|
|
|
|
for (UnitInfo *u : units)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
UnitInfo* u = (*it);
|
|
|
|
|
|
|
|
if (!u || !u->unit || !u->allowEdit) continue;
|
|
|
|
if (!u || !u->unit || !u->allowEdit) continue;
|
|
|
|
prof.apply(u);
|
|
|
|
prof.apply(u);
|
|
|
|
}
|
|
|
|
}
|
|
|
|