Loads more work on battling, initial stretch to run a turn done.
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:
@@ -2,11 +2,11 @@ use crate::dynamic_data::models::pokemon::Pokemon;
|
||||
use std::sync::{Arc, RwLock};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct PokemonParty<'a> {
|
||||
pokemon: Vec<Option<Arc<RwLock<Pokemon<'a>>>>>,
|
||||
pub struct PokemonParty<'pokemon, 'library> {
|
||||
pokemon: Vec<Option<Arc<RwLock<Pokemon<'pokemon, 'library>>>>>,
|
||||
}
|
||||
|
||||
impl<'a> PokemonParty<'a> {
|
||||
impl<'own, 'library> PokemonParty<'own, 'library> {
|
||||
pub fn new(size: usize) -> Self {
|
||||
let mut pokemon = Vec::with_capacity(size);
|
||||
for _i in 0..size {
|
||||
@@ -15,7 +15,7 @@ impl<'a> PokemonParty<'a> {
|
||||
Self { pokemon }
|
||||
}
|
||||
|
||||
pub fn at(&self, index: usize) -> &Option<Arc<RwLock<Pokemon<'a>>>> {
|
||||
pub fn at(&self, index: usize) -> &Option<Arc<RwLock<Pokemon<'own, 'library>>>> {
|
||||
let opt = self.pokemon.get(index);
|
||||
if let Some(v) = opt {
|
||||
v
|
||||
@@ -31,8 +31,8 @@ impl<'a> PokemonParty<'a> {
|
||||
pub fn swap_into(
|
||||
&mut self,
|
||||
index: usize,
|
||||
pokemon: Option<Arc<RwLock<Pokemon<'a>>>>,
|
||||
) -> Option<Arc<RwLock<Pokemon<'a>>>> {
|
||||
pokemon: Option<Arc<RwLock<Pokemon<'own, 'library>>>>,
|
||||
) -> Option<Arc<RwLock<Pokemon<'own, 'library>>>> {
|
||||
if index >= self.pokemon.len() {
|
||||
return pokemon;
|
||||
}
|
||||
@@ -54,7 +54,7 @@ impl<'a> PokemonParty<'a> {
|
||||
self.pokemon.len()
|
||||
}
|
||||
|
||||
pub fn pokemon(&self) -> &Vec<Option<Arc<RwLock<Pokemon<'a>>>>> {
|
||||
pub fn pokemon(&self) -> &Vec<Option<Arc<RwLock<Pokemon<'own, 'library>>>>> {
|
||||
&self.pokemon
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user