Skip to content

Commit

Permalink
Set pending reminder on encounter target change
Browse files Browse the repository at this point in the history
  • Loading branch information
Zerthox committed Jan 13, 2023
1 parent da76899 commit 396ece3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions src/reminder/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ impl Reminder {

/// Handles encounter target change.
pub fn change_encounter(&mut self, target_id: usize, time: u64) {
// only change id, otherwise start as new encounter
// pending check will be handled later
if let Some(encounter) = &mut self.encounter {
encounter.target_id = target_id;
} else {
self.start_encounter(target_id, time);
// only change id if pending, otherwise start as new encounter
match &mut self.encounter {
Some(encounter) if encounter.pending_check => encounter.target_id = target_id,
_ => self.start_encounter(target_id, time),
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/reminder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ struct Encounter {
/// Id of the encounter target.
pub target_id: usize,

/// Time the encounter started.
/// Time the encounter started (or target changed).
pub start_time: u64,

/// Whether there is a pending check for the encounter.
Expand Down

0 comments on commit 396ece3

Please sign in to comment.