Fixes build, style fixes.
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:
@@ -10,8 +10,8 @@ pub struct ScriptSet {
|
||||
impl ScriptSet {
|
||||
pub fn add(&mut self, script: Box<dyn Script>) -> ScriptContainer {
|
||||
if let Some(lock) = self.scripts.get(script.name()) {
|
||||
let existing = lock.get();
|
||||
if let Some(v) = &*existing {
|
||||
let mut existing = lock.get();
|
||||
if let Some(v) = &mut *existing {
|
||||
v.stack();
|
||||
return lock.clone();
|
||||
}
|
||||
@@ -30,8 +30,8 @@ impl ScriptSet {
|
||||
F: Fn() -> PkmnResult<Option<Box<dyn Script>>>,
|
||||
{
|
||||
if let Some(lock) = self.scripts.get(key) {
|
||||
let existing = lock.get();
|
||||
if let Some(v) = &*existing {
|
||||
let mut existing = lock.get();
|
||||
if let Some(v) = &mut *existing {
|
||||
v.stack();
|
||||
return Ok(Some(lock.clone()));
|
||||
}
|
||||
@@ -54,13 +54,13 @@ impl ScriptSet {
|
||||
pub fn remove(&mut self, key: &StringKey) {
|
||||
let value = self.scripts.shift_remove(key);
|
||||
if let Some(script) = value {
|
||||
script.get().as_ref().as_ref().unwrap().on_remove();
|
||||
script.get().as_mut().unwrap().on_remove();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn clear(&mut self) {
|
||||
for script in &self.scripts {
|
||||
script.1.get().as_ref().as_ref().unwrap().on_remove();
|
||||
script.1.get().as_mut().unwrap().on_remove();
|
||||
}
|
||||
self.scripts.clear();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user