|
|
@ -346,18 +346,18 @@ impl Unit { |
|
|
|
if let Some(modifier) = self.modifier {
|
|
|
|
match modifier {
|
|
|
|
UnitModifier::PlusPlus => {
|
|
|
|
result[7] = 3;
|
|
|
|
result[6] = 2;
|
|
|
|
},
|
|
|
|
UnitModifier::Plus => {
|
|
|
|
result[7] = 1;
|
|
|
|
result[6] = 1;
|
|
|
|
},
|
|
|
|
UnitModifier::Minus => {
|
|
|
|
result[6] = 0xFF;
|
|
|
|
result[7] = 0xFF;
|
|
|
|
result[8] = 0xFF;
|
|
|
|
},
|
|
|
|
UnitModifier::MinusMinus => {
|
|
|
|
result[7] = 0xFE;
|
|
|
|
result[8] = 0xFF;
|
|
|
|
result[6] = 0xFE;
|
|
|
|
result[7] = 0xFF;
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -368,8 +368,8 @@ impl Unit { |
|
|
|
pub fn from_bytes(data: [u8; 16]) -> Result<Unit, ItemParseError> {
|
|
|
|
let u = UnitType::parse_type([data[0], data[1], data[2]]);
|
|
|
|
if u.is_ok() {
|
|
|
|
let m = match u16::from_le_bytes([data[7], data[8]]) {
|
|
|
|
0x03 => Some(UnitModifier::PlusPlus),
|
|
|
|
let m = match u16::from_le_bytes([data[6], data[7]]) {
|
|
|
|
0x02 => Some(UnitModifier::PlusPlus),
|
|
|
|
0x01 => Some(UnitModifier::Plus),
|
|
|
|
0xFEFF => Some(UnitModifier::Minus),
|
|
|
|
0xFFFF => Some(UnitModifier::MinusMinus),
|
|
|
|