void OptionListItem::ChangeValue(int iOffset) { if (m_option->GetChoices().size() == 0) return; m_index = ( m_index + iOffset + m_option->GetChoices().size() ) % m_option->GetChoices().size(); if (m_option->ImmediateUpdateNeeded()) UpdateOption(); }
long AddBotDialog::AddMMOptionsToList(long pos, int optFlag) { for (const auto& it : m_battle.CustomBattleOptions().getOptions((LSL::Enum::GameOption)optFlag)) { m_opts_list->InsertItem(pos, TowxString(it.second.first)); const wxString tag = wxString::Format(_T( "%d_%s"), optFlag, TowxString(it.first).c_str()); m_opt_list_map[tag] = pos; UpdateOption(tag); pos++; } return pos; }
long AddBotDialog::AddMMOptionsToList( long pos, int optFlag ) { OptionsWrapper::wxStringTripleVec optlist = m_battle.CustomBattleOptions().getOptions( (OptionsWrapper::GameOption)optFlag ); for ( OptionsWrapper::wxStringTripleVec::const_iterator it = optlist.begin(); it != optlist.end(); ++it ) { m_opts_list->InsertItem( pos, it->second.first ); wxString tag = wxString::Format( _T( "%d_" ), optFlag ) + it->first; m_opt_list_map[ tag ] = pos; UpdateOption( tag ); pos++; } return pos; }
void AddBotDialog::OnOptionActivate(wxListEvent& event) { long index = event.GetIndex(); wxString tag; for (OptionListMap::const_iterator itor = m_opt_list_map.begin(); itor != m_opt_list_map.end(); ++itor) { if (itor->second == index) { tag = itor->first; break; } } LSL::OptionsWrapper& optWrap = m_battle.CustomBattleOptions(); const LSL::Enum::GameOption optFlag = (LSL::Enum::GameOption)FromwxString(tag.BeforeFirst('_')); const std::string key = STD_STRING(tag.AfterFirst('_')); LSL::Enum::OptionType type = optWrap.GetSingleOptionType(key); if (!optWrap.keyExists(key, optFlag, false, type)) return; SingleOptionDialog dlg(m_battle, tag); dlg.ShowModal(); UpdateOption(tag); }
OptionListItem::~OptionListItem(void) { UpdateOption(); }