void SinglePlayerBattle::SendHostInfo( HostInfo update ) { if ( (update & HI_StartType) != 0 ) m_sptab.UpdateMinimap(); if ( (update & HI_Restrictions) != 0 ) m_sptab.ReloadRestrictions(); if ( (update & HI_Map_Changed) != 0 ) { LoadMap(); m_sptab.ReloadMapOptContrls(); Update( wxFormat(_T("%d_%s") ) % LSL::OptionsWrapper::PrivateOptions % _T("mapname") ); } if ( (update & HI_Mod_Changed) != 0 ) { RemoveUnfittingBots(); LoadMod(); wxString presetname = sett().GetModDefaultPresetName( GetHostModName() ); if ( !presetname.IsEmpty() ) { LoadOptionsPreset( presetname ); SendHostInfo( HI_Send_All_opts ); } m_sptab.ReloadModOptContrls(); Update( wxFormat(_T("%d_%s") ) % LSL::OptionsWrapper::PrivateOptions % _T("modname") ); } if ( (update & HI_Send_All_opts) != 0 ) { for ( int i = 0; i < (int)LSL::OptionsWrapper::LastOption; i++) { for (const auto pair : CustomBattleOptions().getOptionsMap( (LSL::OptionsWrapper::GameOption)i)) { Update( wxFormat(_T("%d_%s") ) % i % pair.first ); } } } }
void SinglePlayerBattle::SendHostInfo( HostInfo update ) { if ( (update & HI_StartType) != 0 ) m_sptab.UpdateMinimap(); if ( (update & HI_Restrictions) != 0 ) m_sptab.ReloadRestrictions(); if ( (update & HI_Map_Changed) != 0 ) { LoadMap(); m_sptab.ReloadMapOptContrls(); Update( wxFormat(_T("%d_%s") ) % OptionsWrapper::PrivateOptions % _T("mapname") ); } if ( (update & HI_Mod_Changed) != 0 ) { RemoveUnfittingBots(); LoadMod(); wxString presetname = sett().GetModDefaultPresetName( GetHostModName() ); if ( !presetname.IsEmpty() ) { LoadOptionsPreset( presetname ); SendHostInfo( HI_Send_All_opts ); } m_sptab.ReloadModOptContrls(); Update( wxFormat(_T("%d_%s") ) % OptionsWrapper::PrivateOptions % _T("modname") ); } if ( (update & HI_Send_All_opts) != 0 ) { for ( int i = 0; i < (int)OptionsWrapper::LastOption; i++) { const std::map<wxString,wxString>& options = CustomBattleOptions().getOptionsMap( (OptionsWrapper::GameOption)i ); for ( std::map<wxString,wxString>::const_iterator itor = options.begin(); itor != options.end(); ++itor ) { Update( wxFormat(_T("%d_%s") ) % i % itor->first ); } } } }
SinglePlayerBattle::SinglePlayerBattle( MainSinglePlayerTab& msptab ): m_sptab(msptab), m_me( User( usync().IsLoaded() ? usync().GetDefaultNick() : _T("invalid") ) ) { OnUserAdded( m_me ); m_me.BattleStatus().side = sett().GetBattleLastSideSel( GetHostModName() ); m_me.BattleStatus().colour = sett().GetBattleLastColour(); CustomBattleOptions().setSingleOption( _T("startpostype"), wxFormat(_T("%d") ) % ST_Pick, OptionsWrapper::EngineOption ); }
SinglePlayerBattle::SinglePlayerBattle( MainSinglePlayerTab& msptab ): m_sptab(msptab), m_me( User(sett().GetDefaultNick())) { OnUserAdded( m_me ); m_me.BattleStatus().side = sett().GetBattleLastSideSel( GetHostModName() ); m_me.BattleStatus().colour = sett().GetBattleLastColour(); CustomBattleOptions().setSingleOption( "startpostype", LSL::Util::ToString(ST_Pick), LSL::OptionsWrapper::EngineOption ); ConnectGlobalEvent(this, GlobalEvent::OnUnitsyncReloaded, wxObjectEventFunction(&SinglePlayerBattle::OnUnitsyncReloaded)); }
void Battle::OnRequestBattleStatus() { UserBattleStatus& bs = m_serv.GetMe().BattleStatus(); bs.team = GetFreeTeam( true ); bs.ally = GetFreeAlly( true ); bs.spectator = false; bs.colour = sett().GetBattleLastColour(); bs.side = sett().GetBattleLastSideSel( TowxString(GetHostModName())); // theres some highly annoying bug with color changes on player join/leave. if ( !bs.colour.IsOk() ) bs.colour = GetFreeColour( GetMe() ); SendMyBattleStatus(); }