From: Ian Jackson Date: Sat, 20 Mar 2021 22:58:21 +0000 (+0000) Subject: PieceMoveable: Move calculation into a method on GPiece X-Git-Tag: otter-0.5.0~597 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=fcac897ffb3f38941a748f532f9e103a0ac580cf;p=otter.git PieceMoveable: Move calculation into a method on GPiece Signed-off-by: Ian Jackson --- diff --git a/src/gamestate.rs b/src/gamestate.rs index c5c861d8..fc2a98a7 100644 --- a/src/gamestate.rs +++ b/src/gamestate.rs @@ -314,6 +314,11 @@ impl GPiece { self.xdata.get_mut_exp()? } + pub fn moveable(&self) -> PieceMoveable { + if self.occult.is_active() { PieceMoveable::No } + else { self.moveable } + } + pub fn dummy() -> Self { let gen_dummy = Generation(1); GPiece { diff --git a/src/pcrender.rs b/src/pcrender.rs index 2d1ef7e0..77e9a0f2 100644 --- a/src/pcrender.rs +++ b/src/pcrender.rs @@ -115,8 +115,6 @@ impl PieceRenderInstructions { -> PreparedPieceState { let pri = self; let (pos, zlevel) = pri.pos_zlevel(gpc); - let moveable = if gpc.occult.is_active() { PieceMoveable::No } - else { gpc.moveable }; let r = PreparedPieceState { pos : pos, held : gpc.held, @@ -126,7 +124,7 @@ impl PieceRenderInstructions { angle : pri.angle(gpc).to_compass(), pinned : gpc.pinned, uos : pri.ui_operations(gs, gpc, ipc)?, - moveable, + moveable : gpc.moveable(), }; dbgc!(pri, ipc, gpc, r); r