From f7dfeba83a09ceca521ac1ea6f17a5ef6a2cb80b Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 14 May 2022 21:51:36 +0100 Subject: [PATCH] piece API: rename save_reloaded_hook This is clearer, given that we have load() for turning a spec into a loaded piece. Signed-off-by: Ian Jackson --- src/clock.rs | 4 ++-- src/dice.rs | 3 ++- src/gamestate.rs | 2 +- src/global.rs | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/clock.rs b/src/clock.rs index f679be15..b3c5da3c 100644 --- a/src/clock.rs +++ b/src/clock.rs @@ -743,8 +743,8 @@ impl PieceTrait for Clock { } #[throws(IE)] - fn loaded_hook(&self, piece: PieceId, gs: &mut GameState, - ig: &InstanceRef) { + fn save_reloaded_hook(&self, piece: PieceId, gs: &mut GameState, + ig: &InstanceRef) { // The effect of this is to reload to the amount remaining at the // last game save. That's probably tolerable, and even arguably // better than having the clock "have kept running" during the diff --git a/src/dice.rs b/src/dice.rs index 8fc587b0..014182df 100644 --- a/src/dice.rs +++ b/src/dice.rs @@ -420,7 +420,8 @@ impl PieceTrait for Die { } #[throws(IE)] - fn loaded_hook(&self, piece: PieceId, gs: &mut GameState, _: &InstanceRef) { + fn save_reloaded_hook(&self, piece: PieceId, gs: &mut GameState + , _: &InstanceRef) { self.cooldown_cleanup_hook(&mut gs.pieces, piece)?; } } diff --git a/src/gamestate.rs b/src/gamestate.rs index e215250f..79ccca91 100644 --- a/src/gamestate.rs +++ b/src/gamestate.rs @@ -230,7 +230,7 @@ pub trait PieceTrait: PieceBaseTrait + Downcast + Send + Debug + 'static { _was_held: Option) -> Result { Ok(default()) } - fn loaded_hook(&self, _piece: PieceId, + fn save_reloaded_hook(&self, _piece: PieceId, _gs: &mut GameState, _ig: &InstanceRef) -> Result<(),IE> { Ok(()) } diff --git a/src/global.rs b/src/global.rs index 115345f8..18198514 100644 --- a/src/global.rs +++ b/src/global.rs @@ -1337,7 +1337,8 @@ impl InstanceGuard<'_> { let ig = &mut *g; for (piece, ipc) in ig.ipieces.0.iter() { - ipc.direct_trait_access().loaded_hook(piece, &mut ig.gs, &gref)?; + ipc.direct_trait_access() + .save_reloaded_hook(piece, &mut ig.gs, &gref)?; } for (token, _) in &tokens_players { -- 2.30.2