wolfrpg_map_parser/command/party_graphics_command/
options.rs1#[cfg(feature = "serde")]
2use serde::{Serialize, Deserialize};
3use crate::command::party_graphics_command::operation::Operation;
4use crate::command::party_graphics_command::special_operation::SpecialOperation;
5
6#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
7#[derive(PartialEq, Clone)]
8pub struct Options {
9 operation: Operation,
10 special_operation: SpecialOperation,
11 graphics_is_variable: bool
12}
13
14impl Options {
15 pub fn new(options: u32) -> Self {
16 Self {
17 operation: Operation::new((options & 0x0f) as u8),
18 special_operation: SpecialOperation::new(((options >> 4) & 0x0f) as u8),
19 graphics_is_variable: (options >> 8) & 0b00000001 != 0
20 }
21 }
22
23 pub fn operation(&self) -> &Operation {
24 &self.operation
25 }
26
27 pub fn operation_mut(&mut self) -> &mut Operation {
28 &mut self.operation
29 }
30
31 pub fn special_operation(&self) -> &SpecialOperation {
32 &self.special_operation
33 }
34
35 pub fn special_operation_mut(&mut self) -> &mut SpecialOperation {
36 &mut self.special_operation
37 }
38
39 pub fn graphics_is_variable(&self) -> bool {
40 self.graphics_is_variable
41 }
42
43 pub fn graphics_is_variable_mut(&mut self) -> &mut bool {
44 &mut self.graphics_is_variable
45 }
46}