Merge branch 'fotkurz/plugin-bookkeepingoptimization' into 'master'

Fix #1968: refactor missing_plugins check for better performance

Closes #1968

See merge request veloren/veloren!4463
This commit is contained in:
Marcel 2024-05-17 22:15:40 +00:00
commit 246d90cf22
2 changed files with 3 additions and 3 deletions

View File

@ -3248,8 +3248,8 @@ impl Client {
self.missing_plugins.len()
}
/// number of requested plugins
pub fn num_missing_plugins(&self) -> usize { self.missing_plugins.len() }
/// true if missing_plugins is not empty
pub fn are_plugins_missing(&self) -> bool { !self.missing_plugins.is_empty() }
/// extract list of locally cached plugins to load
pub fn take_local_plugins(&mut self) -> Vec<PathBuf> { std::mem::take(&mut self.local_plugins) }

View File

@ -71,7 +71,7 @@ impl CharSelectionState {
impl PlayState for CharSelectionState {
fn enter(&mut self, global_state: &mut GlobalState, _: Direction) {
// Load the player's character list
if self.client.borrow().num_missing_plugins() == 0 {
if !self.client.borrow().are_plugins_missing() {
self.client.borrow_mut().load_character_list();
}