From: Ian Jackson Date: Fri, 2 Oct 2020 23:17:16 +0000 (+0100) Subject: pin flag, propagate X-Git-Tag: otter-0.2.0~796 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=9cd9caee58d2965de41e828b1c1301cdf77b5c30;p=otter.git pin flag, propagate Signed-off-by: Ian Jackson --- diff --git a/src/bin/otter.rs b/src/bin/otter.rs index 709ffab7..e51b0449 100644 --- a/src/bin/otter.rs +++ b/src/bin/otter.rs @@ -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); diff --git a/src/cmdlistener.rs b/src/cmdlistener.rs index 95d93170..f26e3352 100644 --- a/src/cmdlistener.rs +++ b/src/cmdlistener.rs @@ -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, }; diff --git a/src/gamestate.rs b/src/gamestate.rs index 1027ef5e..51225dca 100644 --- a/src/gamestate.rs +++ b/src/gamestate.rs @@ -57,6 +57,7 @@ pub struct PieceState { pub face : FaceId, pub held : Option, 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()?, } } diff --git a/src/spec.rs b/src/spec.rs index e9359080..5380d0fa 100644 --- a/src/spec.rs +++ b/src/spec.rs @@ -85,6 +85,7 @@ pub struct PiecesSpec { pub posd : Option, pub count : Option, pub face : Option, + pub pinned: Option, #[serde(flatten)] pub info : Box, } diff --git a/src/updates.rs b/src/updates.rs index b573ae83..2fde6220 100644 --- a/src/updates.rs +++ b/src/updates.rs @@ -58,6 +58,7 @@ pub struct PreparedPieceState { pub held : Option, pub z : ZCoord, pub zg : Generation, + pub pinned : bool, pub uos: Vec, }