From: Ian Jackson Date: Sat, 20 Mar 2021 18:45:18 +0000 (+0000) Subject: pass &InstanceRef to held_change_hook X-Git-Tag: otter-0.5.0~628 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=81cb6b88d15cb074aa793f50e7c6ed513970a2a1;p=otter.git pass &InstanceRef to held_change_hook Signed-off-by: Ian Jackson --- diff --git a/daemon/api.rs b/daemon/api.rs index 13ee5246..3fa37d88 100644 --- a/daemon/api.rs +++ b/daemon/api.rs @@ -185,6 +185,7 @@ fn api_piece_op(form: Json>) if gpc.held != was_held; if let Some(ipc) = &g.ipieces.get(piece); if let Ok(unprepared) = ipc.direct_trait_access().held_change_hook( + &iad.gref, &mut g.gs.pieces, was_held, ).map_err(|e| error!("internal error on change hook: {:?}", e)); diff --git a/src/gamestate.rs b/src/gamestate.rs index 56b35c07..85daf5b6 100644 --- a/src/gamestate.rs +++ b/src/gamestate.rs @@ -146,6 +146,7 @@ pub trait PieceTrait: OutlineTrait + Send + Debug + 'static { /// Piece is responsible for dealing with the possibility that they /// may be occulted! fn held_change_hook(&self, + _ig: &InstanceRef, _gpieces: &mut GPieces, _was_held: Option) -> UnpreparedUpdates { None }