Remove lifetime mess, replace a lot of code with Arc instead of borrows.
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This cleans up the codebase massively, and allows me to maintain some semblance of sanity.
This commit is contained in:
@@ -6,17 +6,17 @@ use crate::dynamic_data::models::pokemon_party::PokemonParty;
|
||||
/// A battle party is a wrapper around a party, with the indices for which the party is responsible
|
||||
/// on the field attached.
|
||||
#[derive(Debug)]
|
||||
pub struct BattleParty<'own, 'library> {
|
||||
pub struct BattleParty {
|
||||
/// The party the BattleParty is holding.
|
||||
party: Arc<PokemonParty<'own, 'library>>,
|
||||
party: Arc<PokemonParty>,
|
||||
/// The indices for which the party is responsible, in the format (side, index)
|
||||
responsible_indices: Vec<(u8, u8)>,
|
||||
}
|
||||
|
||||
impl<'own, 'library> BattleParty<'own, 'library> {
|
||||
impl BattleParty {
|
||||
/// Initializes a battle party with the underlying party, and the indices the party is responsible
|
||||
/// for.
|
||||
pub fn new(party: Arc<PokemonParty<'own, 'library>>, responsible_indices: Vec<(u8, u8)>) -> Self {
|
||||
pub fn new(party: Arc<PokemonParty>, responsible_indices: Vec<(u8, u8)>) -> Self {
|
||||
Self {
|
||||
party,
|
||||
responsible_indices,
|
||||
@@ -44,7 +44,7 @@ impl<'own, 'library> BattleParty<'own, 'library> {
|
||||
}
|
||||
|
||||
/// Gets a Pokemon at an index.
|
||||
pub fn get_pokemon(&self, index: usize) -> &Option<Arc<Pokemon<'own, 'library>>> {
|
||||
pub fn get_pokemon(&self, index: usize) -> &Option<Arc<Pokemon>> {
|
||||
self.party.at(index)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user