wolfrpg_map_parser/command/sound_command/
options.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#[cfg(feature = "serde")]
use serde::{Serialize, Deserialize};
use crate::command::sound_command::operation::Operation;
use crate::command::sound_command::process_type::ProcessType;

#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(PartialEq)]
pub struct Options {
    process_type: ProcessType,
    operation: Operation
}

impl Options {
    pub fn new(options: u8) -> Self {
        Self {
            process_type: ProcessType::new(options & 0x0f),
            operation: Operation::new(options >> 4)
        }
    }

    pub fn process_type(&self) -> &ProcessType {
        &self.process_type
    }
    
    pub fn process_type_mut(&mut self) -> &mut ProcessType {
        &mut self.process_type
    }

    pub fn operation(&self) -> &Operation {
        &self.operation
    }
    
    pub fn operation_mut(&mut self) -> &mut Operation {
        &mut self.operation
    }
}