wolfrpg_map_parser/command/event_control_command/move_route/
options.rs

1#[cfg(feature = "serde")]
2use serde::{Serialize, Deserialize};
3
4#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
5#[derive(PartialEq, Clone)]
6pub struct Options {
7    repeat_actions: bool,
8    skip_impossible_moves: bool,
9    wait_until_done: bool,
10}
11
12impl Options {
13    pub const fn new(options: u8) -> Self {
14        Self {
15            repeat_actions:         options & 0b00000001 != 0,
16            skip_impossible_moves:  options & 0b00000010 != 0,
17            wait_until_done:        options & 0b00000100 != 0,
18        }
19    }
20
21    pub fn repeat_actions(&self) -> bool {
22        self.repeat_actions
23    }
24    
25    pub fn repeat_actions_mut(&mut self) -> &mut bool {
26        &mut self.repeat_actions
27    }
28
29    pub fn skip_impossible_moves(&self) -> bool {
30        self.skip_impossible_moves
31    }
32    
33    pub fn skip_impossible_moves_mut(&mut self) -> &mut bool {
34        &mut self.skip_impossible_moves
35    }
36
37    pub fn wait_until_done(&self) -> bool {
38        self.wait_until_done
39    }
40    
41    pub fn wait_until_done_mut(&mut self) -> &mut bool {
42        &mut self.wait_until_done
43    }
44}