chiark / gitweb /
angles: Reinstate compatibility with mf1 format
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 23 May 2022 18:07:33 +0000 (19:07 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 23 May 2022 18:07:33 +0000 (19:07 +0100)
We don't need to check the mformat, since the old syntax is disjoint
from the new one.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/spec.rs

index 9fea2654796e1da8c73e8185ae00e90e18b0beaf..a5eb031fa7d4da2fcf017110c66291d5af729f70 100644 (file)
@@ -235,6 +235,8 @@ pub struct PiecesSpec {
 pub enum PieceAngleSpec {
   Compass(String),
   Degrees(i32),
+
+  CompatMF1 { #[serde(rename="Compass")] i: u8 },
 }
 
 #[derive(Debug,Copy,Clone,Serialize,Deserialize)]
@@ -680,6 +682,7 @@ pub mod imp {
           if deg % 45 != 0 { throw!(SpE::CompassAngleInvalid) }
           (deg / 45) as u8
         },
+        Some(PAS::CompatMF1 { i }) => *i,
       };
       PieceAngle::Compass(i.try_into()?)
     }