Skip to content

Commit

Permalink
MessageMap: Fix panics for messages outside of map
Browse files Browse the repository at this point in the history
  • Loading branch information
ozkriff committed Jul 9, 2021
1 parent 61deaad commit 0e8ec15
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/screen/battle/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ impl MessagesMap {
}

pub fn delay_at(&self, pos: PosHex) -> Option<Duration> {
if !self.map.is_inboard(pos) {
return None;
}
self.map.tile(pos)
}

Expand Down Expand Up @@ -146,7 +149,9 @@ impl MessagesMap {
}

pub fn register_message_at(&mut self, pos: PosHex, duration: Duration) {
assert!(self.map.is_inboard(pos));
if !self.map.is_inboard(pos) {
return;
}
let duration = duration.mul_f32(0.5);
self.mark_tile_as_busy(pos, duration);
// Also mark neighbors to the left and to the right as busy.
Expand Down

0 comments on commit 0e8ec15

Please sign in to comment.