bool IBattle::LoadOptionsPreset( const std::string& name ) { const std::string preset = FixPresetName(name); if (preset.empty()) return false; //preset not found m_preset = preset; for ( unsigned int i = 0; i < LSL::OptionsWrapper::LastOption; i++) { std::map<wxString,wxString> options = sett().GetHostingPreset( TowxString(m_preset), i ); if ( (LSL::OptionsWrapper::GameOption)i != LSL::OptionsWrapper::PrivateOptions ) { for ( std::map<wxString,wxString>::const_iterator itor = options.begin(); itor != options.end(); ++itor ) { wxLogWarning( itor->first + _T(" ::: ") + itor->second ); CustomBattleOptions().setSingleOption( STD_STRING(itor->first), STD_STRING(itor->second), (LSL::OptionsWrapper::GameOption)i ); } } else { if ( !options[_T("mapname")].IsEmpty() ) { if (LSL::usync().MapExists(STD_STRING(options[_T("mapname")]))) { SetLocalMap( STD_STRING(options[_T("mapname")]) ); SendHostInfo( HI_Map ); } else if ( !ui().OnPresetRequiringMap( options[_T("mapname")] ) ) { //user didn't want to download the missing map, so set to empty to not have it tried to be loaded again options[_T("mapname")] = wxEmptyString; sett().SetHostingPreset( TowxString(m_preset), i, options ); } } for( unsigned int j = 0; j <= GetLastRectIdx(); ++j ) { if ( GetStartRect( j ).IsOk() ) RemoveStartRect(j); // remove all rects that might come from map presets } SendHostInfo( IBattle::HI_StartRects ); unsigned int rectcount = s2l( options[_T("numrects")] ); for ( unsigned int loadrect = 0; loadrect < rectcount; loadrect++) { int ally = s2l(options[_T("rect_") + TowxString(loadrect) + _T("_ally")]); if ( ally == 0 ) continue; AddStartRect( ally - 1, s2l(options[_T("rect_") + TowxString(loadrect) + _T("_left")]), s2l(options[_T("rect_") + TowxString(loadrect) + _T("_top")]), s2l(options[_T("rect_") + TowxString(loadrect) + _T("_right")]), s2l(options[_T("rect_") + TowxString(loadrect) + _T("_bottom")]) ); } SendHostInfo( HI_StartRects ); wxStringTokenizer tkr( options[_T("restrictions")], _T('\t') ); m_restricted_units.clear(); while( tkr.HasMoreTokens() ) { wxString unitinfo = tkr.GetNextToken(); RestrictUnit( STD_STRING(unitinfo.BeforeLast(_T('='))), s2l( unitinfo.AfterLast(_T('=')) ) ); } SendHostInfo( HI_Restrictions ); Update( wxFormat( _T("%d_restrictions") ) % LSL::OptionsWrapper::PrivateOptions ); } } SendHostInfo( HI_Send_All_opts ); ui().ReloadPresetList(); return true; }
void formula_lexer::tokenize() { #if IXION_DEBUG_LEXER __IXION_DEBUG_OUT__ << "formula string: '" << std::string(mp_first, m_size) << "'" << endl; #endif tokenizer tkr(m_tokens, mp_first, m_size); tkr.run(); #if IXION_DEBUG_LEXER __IXION_DEBUG_OUT__ << print_tokens(m_tokens, true) << endl; #endif }