chiark / gitweb /
pin flag, propagate
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 2 Oct 2020 23:17:16 +0000 (00:17 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 2 Oct 2020 23:17:16 +0000 (00:17 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/bin/otter.rs
src/cmdlistener.rs
src/gamestate.rs
src/spec.rs
src/updates.rs

index 709ffab79d2048bf064c3a42db62a5977909503b..e51b0449cdd51f40fd9bd50edc0049a5c4499539 100644 (file)
@@ -715,6 +715,7 @@ mod library_add {
         posd: None,
         count: Some(to_add as u32),
         face: None,
+        pinned: Some(false),
         info: Box::new(spec),
       };
       Poor(vec![ Insn::AddPieces(spec) ],
@@ -858,7 +859,7 @@ mod library_add {
       };
       let spec = PiecesSpec {
         pos: Some(pos),
-        posd: None, count: Some(1), face: None,
+        posd: None, count: Some(1), face: None, pinned: Some(false),
         info: Box::new(spec),
       };
       let insn = Insn::AddPieces(spec);
index 95d93170cffc44c987262ad9fe4009ddff82bd7f..f26e335245ab1fc50bede5e204d69009aad40ff5 100644 (file)
@@ -253,7 +253,7 @@ fn execute_game_insn(cs: &CommandStream,
        Fine)
     },
 
-    AddPieces(PiecesSpec{ pos,posd,count,face,info }) => {
+    AddPieces(PiecesSpec{ pos,posd,count,face,pinned,info }) => {
       let modperm = ig.modify_pieces();
       let ig = &mut **ig;
       let gs = &mut ig.gs;
@@ -275,6 +275,7 @@ fn execute_game_insn(cs: &CommandStream,
           zlevel: ZLevel { z, zg: gs.gen },
           lastclient: Default::default(),
           gen_before_lastclient: Generation(0),
+          pinned: pinned.unwrap_or(false),
           gen: gs.gen,
           pos, face,
         };
index 1027ef5e5826da051ba953dfcb80ecfb24a21a43..51225dca3e8540a6127b96dbdc4ef1d5b2a2843e 100644 (file)
@@ -57,6 +57,7 @@ pub struct PieceState {
   pub face : FaceId,
   pub held : Option<PlayerId>,
   pub zlevel : ZLevel,
+  pub pinned: bool,
   pub gen : Generation,
   pub lastclient : ClientId,
   pub gen_before_lastclient : Generation,
@@ -230,6 +231,7 @@ impl PieceState {
       svg        : p.make_defs(pri)?,
       z          : self.zlevel.z,
       zg         : self.zlevel.zg,
+      pinned     : self.pinned,
       uos        : p.ui_operations()?,
     }
   }
index e9359080effebcd4595b9e9d7fb56a7600c03ff5..5380d0fab8c38ec003ebc976e3a09b416ee5f2f7 100644 (file)
@@ -85,6 +85,7 @@ pub struct PiecesSpec {
   pub posd : Option<Pos>,
   pub count : Option<u32>,
   pub face : Option<FaceId>,
+  pub pinned: Option<bool>,
   #[serde(flatten)]
   pub info : Box<dyn PieceSpec>,
 }
index b573ae83bc1f3dff999dadd41e60cdfb93c2d167..2fde6220cc04fc45b048aeceb23f78765cee5902 100644 (file)
@@ -58,6 +58,7 @@ pub struct PreparedPieceState {
   pub held : Option<PlayerId>,
   pub z : ZCoord,
   pub zg : Generation,
+  pub pinned : bool,
   pub uos: Vec<UoDescription>,
 }