wolfrpg_map_parser/command/transfer_command/
options.rs

1#[cfg(feature = "serde")]
2use serde::{Serialize, Deserialize};
3use crate::command::transfer_command::transition::Transition;
4
5#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
6#[derive(PartialEq, Clone)]
7pub struct Options {
8    precise_coordinates: bool,
9    transition: Transition,
10}
11
12impl Options {
13    pub fn new(options: u32) -> Self {
14        Self {
15            precise_coordinates: options & 0b00000001 != 0,
16            transition: Transition::new(((options >> 4) & 0x0f) as u8),
17        }
18    }
19
20    pub fn precise_coordinates(&self) -> bool {
21        self.precise_coordinates
22    }
23    
24    pub fn precise_coordinates_mut(&mut self) -> &mut bool {
25        &mut self.precise_coordinates
26    }
27
28    pub fn transition(&self) -> &Transition {
29        &self.transition
30    }
31    
32    pub fn transition_mut(&mut self) -> &mut Transition {
33        &mut self.transition
34    }
35}