fix previous not adding back to queue

This commit is contained in:
emilis 2025-10-13 01:21:34 +01:00
parent 9f00d2b912
commit 2075f07bb7
No known key found for this signature in database
1 changed files with 6 additions and 5 deletions

View File

@ -319,7 +319,7 @@ impl Night {
} }
NightState::Complete => return Err(GameError::NightOver), NightState::Complete => return Err(GameError::NightOver),
}; };
if let Some((prompt, _, changes)) = self.used_actions.pop() { if let Some((mut prompt, _, changes)) = self.used_actions.pop() {
// Remove the shapeshifter role change from the queue // Remove the shapeshifter role change from the queue
if let ActionPrompt::Shapeshifter { if let ActionPrompt::Shapeshifter {
character_id: ss_char, character_id: ss_char,
@ -337,8 +337,9 @@ impl Night {
// put it back in // put it back in
self.action_queue.push_front(next); self.action_queue.push_front(next);
} }
// panic!("{:#?}", self.action_queue.pop_front()); core::mem::swap(&mut prompt, current_prompt);
*current_prompt = prompt; let last_prompt = prompt;
self.action_queue.push_front(last_prompt);
*current_result = None; *current_result = None;
*current_changes = Vec::new(); *current_changes = Vec::new();
Ok(()) Ok(())
@ -369,7 +370,7 @@ impl Night {
if self.village.character_by_id(recruiting)?.is_village() { if self.village.character_by_id(recruiting)?.is_village() {
if let Some(masons) = self.action_queue.iter_mut().find_map(|a| match a { if let Some(masons) = self.action_queue.iter_mut().find_map(|a| match a {
ActionPrompt::MasonsWake { leader, masons, .. } => { ActionPrompt::MasonsWake { leader, masons, .. } => {
(*leader == mason_leader).then_some(masons) (leader.character_id == mason_leader).then_some(masons)
} }
_ => None, _ => None,
}) { }) {
@ -378,7 +379,7 @@ impl Night {
*masons = ext_masons.into_boxed_slice(); *masons = ext_masons.into_boxed_slice();
} else { } else {
self.action_queue.push_front(ActionPrompt::MasonsWake { self.action_queue.push_front(ActionPrompt::MasonsWake {
leader: self.village.character_by_id(mason_leader)?.character_id(), leader: self.village.character_by_id(mason_leader)?.identity(),
masons: Box::new([self.village.character_by_id(recruiting)?.identity()]), masons: Box::new([self.village.character_by_id(recruiting)?.identity()]),
}); });
} }