MP Create: hide Mods header if none are available

This commit is contained in:
Charles Dang 2016-09-01 07:11:28 +11:00
parent c08c55b704
commit 4308baac80
2 changed files with 7 additions and 4 deletions

View file

@ -168,6 +168,7 @@
vertical_alignment = "top"
[label]
id = "mods_header"
definition = "default"
label = _ "Modifications:"
[/label]

View file

@ -242,7 +242,12 @@ void tmp_create_game::pre_show(twindow& window)
dialog_callback<tmp_create_game, &tmp_create_game::on_mod_select>);
#endif
on_mod_select(window);
// No mods, hide the header
if(mod_list.get_item_count() <= 0) {
find_widget<tcontrol>(&window, "mods_header", false).set_visible(twindow::tvisible::invisible);
} else {
on_mod_select(window);
}
//
// Set up random faction mode menu_button
@ -434,9 +439,6 @@ void tmp_create_game::on_tab_select(twindow& window)
void tmp_create_game::on_mod_select(twindow& window)
{
if (find_widget<tlistbox>(&window, "mod_list", false).get_item_count() <= 0) // no modifications installed
return;
create_engine_.set_current_mod_index(find_widget<tlistbox>(&window, "mod_list", false).get_selected_row());
show_description(window, create_engine_.current_extra(ng::create_engine::MOD).description);