From f9761f61da7d7f44a9cc1bc0c586ea4a4d578ae0 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sun, 28 Aug 2022 15:50:39 +0200 Subject: [PATCH] make ChoiceQueue::move_pokemon_choice_next return a bool for success --- src/dynamic_data/flow/choice_queue.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/dynamic_data/flow/choice_queue.rs b/src/dynamic_data/flow/choice_queue.rs index fcbcb1f..f262b6b 100644 --- a/src/dynamic_data/flow/choice_queue.rs +++ b/src/dynamic_data/flow/choice_queue.rs @@ -50,7 +50,7 @@ impl ChoiceQueue { } /// This moves the choice of a specific Pokemon up to the next choice to be executed. - pub fn move_pokemon_choice_next(&mut self, pokemon: &Pokemon) { + pub fn move_pokemon_choice_next(&mut self, pokemon: &Pokemon) -> bool { let mut desired_index = None; // Find the index for the choice we want to move up. for index in self.current..self.queue.len() { @@ -63,12 +63,12 @@ impl ChoiceQueue { } // If we couldn't find a choice, we can't execute, return. if desired_index.is_none() { - return; + return false; } let desired_index = desired_index.unwrap(); // If the choice we want to move up is already the next choice, just return. if desired_index == self.current { - return; + return true; } // Take the choice we want to move forward out of it's place. @@ -80,6 +80,7 @@ impl ChoiceQueue { } // Place the choice that needs to be next in the next to be executed position. let _ = self.queue[self.current].insert(choice); + true } /// Internal helper function to be easily able to iterate over the yet to be executed choices.