void BattleroomMMOptionsTab::setupOptionsSizer(wxBoxSizer* parent_sizer,
					       LSL::Enum::GameOption optFlag)
{
	if (!m_battle)
		return;
	unsigned int num_options = 0;
	for (const auto& it : m_battle->CustomBattleOptions().m_opts[optFlag].section_map) {
		wxStaticBoxSizer* section_sizer = new wxStaticBoxSizer(
		    new wxStaticBox(this, wxID_ANY, TowxString(it.second.name)), wxVERTICAL);
		//only add non-empty sizer
		if (setupOptionsSectionSizer(it.second, section_sizer, optFlag)) {
			parent_sizer->Add(section_sizer, 0, wxALL, section_sizer->GetChildren().size() > 0 ? 5 : 0);
			num_options++;
		} else
			wxDELETE(section_sizer);
	}

	//adds options with no asociated section
	LSL::mmOptionSection dummy;
	wxBoxSizer* section_sizer = new wxBoxSizer(wxVERTICAL);
	if (setupOptionsSectionSizer(dummy, section_sizer, optFlag) == 0) {
		if (num_options == 0) {
			wxString name = wxString::Format(_T("%d%sno_opts"), optFlag, wxsep.c_str());
			wxStaticText* none_found = new wxStaticText(this, wxID_ANY, _("no options available"),
								    wxDefaultPosition, wxDefaultSize, 0, name);
			m_statictext_map[name] = none_found;
			parent_sizer->Add(none_found, 0, wxALL, 3);
		}
	} else {
		wxStaticBoxSizer* other_section = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("other")), wxVERTICAL);
		other_section->Add(section_sizer, 0, wxALL, section_sizer->GetChildren().size() > 0 ? 5 : 0);
		parent_sizer->Add(other_section, 0, wxALL, 0);
	}
}
void BattleroomMMOptionsTab<BattleType>::setupOptionsSizer( wxBoxSizer* parent_sizer, OptionsWrapper::GameOption optFlag )
{
		if ( !m_battle ) return;
    const SpringUnitSync::OptionMapSection& sections = m_battle->CustomBattleOptions().m_opts[optFlag].section_map;

    unsigned int num_options = 0;
    SpringUnitSync::OptionMapSectionConstIter it = sections.begin();
    for ( ; it != sections.end(); ++it )
    {
        wxStaticBoxSizer* section_sizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, it->second.name ), wxVERTICAL );
        //only add non-empty sizer
        if ( setupOptionsSectionSizer( it->second, section_sizer, optFlag ) ) {
            parent_sizer->Add( section_sizer, 0 , wxALL, section_sizer->GetChildren().size() > 0 ? 5 : 0 );
            num_options++;
        }
        else
            delete section_sizer;
    }

    //adds options with no asociated section
    mmOptionSection dummy;
    wxBoxSizer* section_sizer = new wxBoxSizer( wxVERTICAL );
    if ( setupOptionsSectionSizer( dummy, section_sizer, optFlag ) == 0 ) {
        if ( num_options == 0 ) {
			wxString name = wxFormat( _T("%d%sno_opts") ) %optFlag % wxsep;
            wxStaticText* none_found = new wxStaticText( this, wxID_ANY, _("no options available"),
                                            wxDefaultPosition, wxDefaultSize, 0, name  );
            m_statictext_map[name] = none_found;
            parent_sizer->Add( none_found, 0, wxALL, 3 );
        }
    }
    else {
        wxStaticBoxSizer* other_section = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("other") ), wxVERTICAL );
        other_section->Add( section_sizer, 0 , wxALL, section_sizer->GetChildren().size() > 0 ? 5 : 0 );
        parent_sizer->Add( other_section, 0 , wxALL, 0 );
    }

}