wolfrpg_map_parser/command/number_condition_command/
operator.rs1#[cfg(feature = "serde")]
2use serde::{Serialize, Deserialize};
3use crate::common::compare_operator::CompareOperator;
4
5#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
6#[derive(PartialEq, Clone)]
7pub struct Operator {
8 operator: CompareOperator,
9 not_variable: bool,
10}
11
12impl Operator {
13 pub fn new(operator: u8) -> Self {
14 Self {
15 operator: CompareOperator::new(operator & 0x0f),
16 not_variable: operator & 0b00010000 != 0,
17 }
18 }
19
20 pub fn operator(&self) -> &CompareOperator {
21 &self.operator
22 }
23
24 pub fn operator_mut(&mut self) -> &mut CompareOperator {
25 &mut self.operator
26 }
27
28 pub fn not_variable(&self) -> bool {
29 self.not_variable
30 }
31
32 pub fn not_variable_mut(&mut self) -> &mut bool {
33 &mut self.not_variable
34 }
35}