More work on using interior mutability instead of exterior mutability for dynamic types (Battle, Pokemon, etc).
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
use crate::dynamic_data::models::pokemon::Pokemon;
|
||||
use crate::dynamic_data::models::pokemon_party::PokemonParty;
|
||||
use parking_lot::RwLock;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -27,7 +26,6 @@ impl<'own, 'library> BattleParty<'own, 'library> {
|
||||
|
||||
pub fn has_pokemon_not_in_field(&self) -> bool {
|
||||
for pokemon in self.party.pokemon().iter().flatten() {
|
||||
let pokemon = pokemon.read();
|
||||
if pokemon.is_usable() && !pokemon.is_on_battlefield() {
|
||||
return true;
|
||||
}
|
||||
@@ -35,7 +33,7 @@ impl<'own, 'library> BattleParty<'own, 'library> {
|
||||
false
|
||||
}
|
||||
|
||||
pub fn get_pokemon(&self, index: usize) -> &Option<Arc<RwLock<Pokemon<'own, 'library>>>> {
|
||||
pub fn get_pokemon(&self, index: usize) -> &Option<Arc<Pokemon<'own, 'library>>> {
|
||||
self.party.at(index)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user