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 ); } } } }
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 ); } } } }
bool IBattle::IsSynced() { LoadMod(); LoadMap(); bool synced = true; if ( !m_host_map.hash.IsEmpty() && m_host_map.hash != '0' && m_host_map.hash != m_local_map.hash ) synced = false; else if ( !m_host_map.name.IsEmpty() && m_local_map.name != m_host_map.name) synced = false; else if ( !m_host_mod.hash.IsEmpty() && m_host_mod.hash != '0' && m_host_mod.hash != m_local_mod.hash ) synced = false; else if ( !m_host_mod.name.IsEmpty() && m_local_mod.name != m_host_mod.name) synced = false; return synced; }
bool IBattle::IsSynced() { LoadMod(); LoadMap(); bool synced = true; if ( !m_host_map.hash.empty() && m_host_map.hash != "0" && m_host_map.hash != m_local_map.hash ) { synced = false; } else if ( !m_host_map.name.empty() && m_local_map.name != m_host_map.name) { synced = false; } else if ( !m_host_mod.hash.empty() && m_host_mod.hash != "0" && m_host_mod.hash != m_local_mod.hash ) { synced = false; } else if ( !m_host_mod.name.empty() && m_local_mod.name != m_host_mod.name) { synced = false; } else if ( !MapExists() || !ModExists() ) { synced = false; } return synced; }