wolfrpg_map_parser/command/sound_command/
options.rs

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