Add missing move checks
This commit is contained in:
parent
3b1db890b7
commit
6eb184c6ae
1 changed files with 6 additions and 2 deletions
|
|
@ -102,7 +102,10 @@ impl ActualWorld {
|
|||
match mv {
|
||||
Move::Noop => {}
|
||||
Move::TryTag(other_id) => {
|
||||
// FIXME check distance
|
||||
let my_pos = self.state.agent_positions.get(&id).unwrap();
|
||||
let other_pos = self.state.agent_positions.get(&other_id).unwrap();
|
||||
assert!((my_pos.x - other_pos.x).abs() <= 1);
|
||||
assert!((my_pos.y - other_pos.y).abs() <= 1);
|
||||
assert_eq!(self.state.tagged, id);
|
||||
assert_ne!(self.state.tagged_by, Some(*other_id));
|
||||
assert!(
|
||||
|
|
@ -111,7 +114,8 @@ impl ActualWorld {
|
|||
);
|
||||
}
|
||||
Move::TryMove(dir) => {
|
||||
// FIXME check speed
|
||||
assert!(dir.x.abs() <= 1);
|
||||
assert!(dir.y.abs() <= 1);
|
||||
let pos = self.state.agent_positions.get(&id).unwrap();
|
||||
let size = &self.size;
|
||||
assert!(pos.x + dir.x > 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue