Implements the script source methods on all current structs that implement it.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-06-12 18:41:49 +02:00
parent f0bc62ce19
commit 00f66bbf59
5 changed files with 27 additions and 8 deletions

View File

@@ -23,6 +23,8 @@ pub struct BattleSide<'a> {
battle: Weak<RwLock<Battle<'a>>>,
has_fled_battle: bool,
volatile_scripts: Arc<RwLock<ScriptSet>>,
script_source_data: RwLock<ScriptSourceData>,
}
impl<'a> BattleSide<'a> {
@@ -47,6 +49,7 @@ impl<'a> BattleSide<'a> {
battle,
has_fled_battle: false,
volatile_scripts: Default::default(),
script_source_data: Default::default(),
}
}
pub fn index(&self) -> u8 {
@@ -277,11 +280,11 @@ impl<'a> VolatileScripts<'a> for BattleSide<'a> {
impl<'a> ScriptSource<'a> for BattleSide<'a> {
fn get_script_count(&self) -> usize {
todo!()
self.battle.upgrade().unwrap().read().get_script_count() + 1
}
fn get_script_source_data(&self) -> &RwLock<ScriptSourceData> {
todo!()
&self.script_source_data
}
fn get_own_scripts(&self, scripts: &mut Vec<ScriptWrapper>) {