From a5393c10e69729777ca3031e11d348a0200af3fd Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 9 Apr 2022 17:05:35 +0100 Subject: [PATCH] Remove loaded_via_alias This effectively reverts 707b43736d838436777f53b230e64054ecb244c5. I have checked that this field is not used anywhere, including in any relevant serialised output eg via the command listener. As for game save compatibility, we can simply ignore it on read (and, even go backwards since it's Option). Signed-off-by: Ian Jackson --- daemon/cmdlistener.rs | 4 ++-- src/clock.rs | 1 - src/deck.rs | 1 - src/gamestate.rs | 1 - src/global.rs | 1 - src/hand.rs | 1 - src/pcaliases.rs | 3 +-- src/pieces.rs | 1 - src/shapelib.rs | 1 - 9 files changed, 3 insertions(+), 11 deletions(-) diff --git a/daemon/cmdlistener.rs b/daemon/cmdlistener.rs index 600f1043..ebf38ee0 100644 --- a/daemon/cmdlistener.rs +++ b/daemon/cmdlistener.rs @@ -1110,7 +1110,7 @@ fn execute_game_insn<'cs, 'igr, 'ig: 'igr>( last_released: default(), rotateable: true, }; - let PieceSpecLoaded { p, loaded_via_alias, occultable } = + let PieceSpecLoaded { p, occultable } = info.load(piece_i as usize, &mut gpc, ig, SpecDepth::zero())?; if p.nfaces() <= face.into() { throw!(SpecError::FaceNotFound); @@ -1126,7 +1126,7 @@ fn execute_game_insn<'cs, 'igr, 'ig: 'igr>( ilks.create(ilkname, OccultIlkData { p_occ }) }); ig.ipieces.as_mut(modperm).insert(piece, IPiece { - p, occilk, loaded_via_alias, + p, occilk, }); updates.push((piece, PieceUpdateOp::Insert(()))); })(); // <- no ?, infallible (to avoid leaking ilk) diff --git a/src/clock.rs b/src/clock.rs index af8fc00a..69bcf432 100644 --- a/src/clock.rs +++ b/src/clock.rs @@ -416,7 +416,6 @@ impl PieceSpec for Spec { PieceSpecLoaded { p: Box::new(clock), - loaded_via_alias: None, occultable: None, } } diff --git a/src/deck.rs b/src/deck.rs index 216dbcd2..55fe7ca3 100644 --- a/src/deck.rs +++ b/src/deck.rs @@ -65,7 +65,6 @@ impl PieceSpec for piece_specs::Deck { }) as Box; PieceSpecLoaded { p, - loaded_via_alias: None, occultable: None, } } diff --git a/src/gamestate.rs b/src/gamestate.rs index 7571c1b6..8e8a78b5 100644 --- a/src/gamestate.rs +++ b/src/gamestate.rs @@ -258,7 +258,6 @@ pub struct ApiPieceOpArgs<'a> { #[derive(Debug)] pub struct PieceSpecLoaded { pub p: Box, - pub loaded_via_alias: Option, pub occultable: PieceSpecLoadedOccultable, } pub type PieceSpecLoadedOccultable = diff --git a/src/global.rs b/src/global.rs index 6b4471c6..5b70f336 100644 --- a/src/global.rs +++ b/src/global.rs @@ -79,7 +79,6 @@ pub struct IPlayer { // usual variable: ipl #[derive(Debug,Serialize,Deserialize)] pub struct IPiece { pub p: IPieceTraitObj, - #[serde(default)] pub loaded_via_alias: Option, pub occilk: Option, } deref_to_field!{IPiece, IPieceTraitObj, p} diff --git a/src/hand.rs b/src/hand.rs index ba48ab3c..a0725413 100644 --- a/src/hand.rs +++ b/src/hand.rs @@ -110,7 +110,6 @@ impl piece_specs::OwnedCommon { }) as Box; PieceSpecLoaded { p, - loaded_via_alias: None, occultable: None, } } diff --git a/src/pcaliases.rs b/src/pcaliases.rs index 9ef363a4..3bf7c632 100644 --- a/src/pcaliases.rs +++ b/src/pcaliases.rs @@ -66,9 +66,8 @@ impl PieceSpec for Alias { #[throws(SpecError)] fn load(&self, i: usize, gpc: &mut GPiece, ig: &Instance, depth: SpecDepth) -> PieceSpecLoaded { - let mut r = self.resolve(&ig.pcaliases)? + let r = self.resolve(&ig.pcaliases)? .load(i, gpc, ig, self.new_depth(depth)?)?; - r.loaded_via_alias = Some(self.target.clone()); r } #[throws(SpecError)] diff --git a/src/pieces.rs b/src/pieces.rs index 1c7ed1be..c213e1a3 100644 --- a/src/pieces.rs +++ b/src/pieces.rs @@ -302,7 +302,6 @@ pub trait SimplePieceSpec: Debug { fn load(&self) -> PieceSpecLoaded { PieceSpecLoaded { p: Box::new(self.load_raw()?.0), - loaded_via_alias: None, occultable: None, } } diff --git a/src/shapelib.rs b/src/shapelib.rs index 4e8ef438..1e896da1 100644 --- a/src/shapelib.rs +++ b/src/shapelib.rs @@ -477,7 +477,6 @@ impl From for PieceSpecLoaded { PieceSpecLoaded { p, occultable, - loaded_via_alias: None, } } } -- 2.30.2