Example #1
0
void BattleRoomTab::UpdateBattleInfo()
{
	if ( !m_battle ) return;
	m_lock_chk->SetValue( m_battle->IsLocked() );
	m_minimap->UpdateMinimap();
	UpdateMapInfoSummary();
}
Example #2
0
void BattleRoomTab::UpdateBattleInfo(const wxString& Tag)
{
	if (!m_battle)
		return;

	const long index = m_opt_list_map[Tag];
	if (index >= m_opts_list->GetItemCount()) {
		wxLogDebug(_T("UpdateBattleInfo: Invalid index %d %d %s"), index, m_opts_list->GetItemCount(), Tag.c_str());
		return;
	}

	LSL::Enum::GameOption type = (LSL::Enum::GameOption)FromwxString(Tag.BeforeFirst('_'));
	wxString key = Tag.AfterFirst('_');
	if ((type == LSL::Enum::MapOption) || (type == LSL::Enum::ModOption) || (type == LSL::Enum::EngineOption)) {
		LSL::Enum::OptionType DataType = m_battle->CustomBattleOptions().GetSingleOptionType(STD_STRING(key));
		wxString value = TowxString(m_battle->CustomBattleOptions().getSingleValue(STD_STRING(key), (LSL::Enum::GameOption)type));
		if (TowxString(m_battle->CustomBattleOptions().getDefaultValue(STD_STRING(key), type)) == value) {
			m_opts_list->SetItemFont(index, wxFont(8, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_LIGHT));
		} else {
			m_opts_list->SetItemFont(index, wxFont(8, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD));
		}
		if (DataType == LSL::Enum::opt_bool) {
			value = bool2yn(FromwxString(value)); // convert from 0/1 to literal Yes/No
		} else if (DataType == LSL::Enum::opt_list) {
			value = TowxString(m_battle->CustomBattleOptions().GetNameListOptValue(STD_STRING(key), type)); // get the key full name not short key
		}
		m_opts_list->SetItem(index, 1, value);
	} else // if ( type == OptionsWrapper::PrivateOptions )
	{
		if (key == _T( "mapname" )) // the map has been changed
		{
			UpdateMapInfoSummary();

			wxString mapname = TowxString(m_battle->GetHostMapName());
			int index_ = m_map_combo->FindString(mapname);
			if (index_ != wxNOT_FOUND)
				m_map_combo->SetSelection(index_);
			else
				m_map_combo->SetValue(mapname);

			//delete any eventual map option from the list and add options of the new map
			for (int i = m_map_opts_index; i < m_opts_list->GetItemCount();) {
				m_opts_list->DeleteItem(i);
			}
			AddMMOptionsToList(m_map_opts_index, LSL::Enum::MapOption);

			m_minimap->UpdateMinimap();

		} else if (key == _T( "restrictions" )) {
			m_opts_list->SetItem(index, 1, bool2yn(m_battle->RestrictedUnits().size() > 0));
		}
	}
}
Example #3
0
void BattleRoomTab::UpdateBattleInfo()
{
	if (!m_battle)
		return;
	m_lock_chk->SetValue(m_battle->IsLocked());
	m_minimap->UpdateMinimap();
	OptionListMap::iterator it;
	for (it = m_opt_list_map.begin(); it != m_opt_list_map.end(); ++it) {
		UpdateBattleInfo(it->first);
	}
	UpdateMapInfoSummary();
}