Fix #1968: refactor missing_plugins check for better performance

This commit is contained in:
fotkurz 2024-05-16 13:22:11 -03:00
parent b2d7a9291a
commit 13a3c53307
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();
}