chiark / gitweb /
PieceTrait, global: Provide loaded_hook() with &InstanceRef
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 20 Mar 2021 22:21:35 +0000 (22:21 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 20 Mar 2021 22:21:35 +0000 (22:21 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/gamestate.rs
src/global.rs

index de5ecbbb6734deee1b83a1b0ec29ba21fc0922c0..d094dcbd840f6790d6ad838508f7f49fee935bb9 100644 (file)
@@ -153,7 +153,8 @@ pub trait PieceTrait: OutlineTrait + Send + Debug + 'static {
                       -> UnpreparedUpdates { None }
 
   #[throws(IE)]
-  fn loaded_hook(&self, _piece: PieceId, _gs: &mut GameState) { }
+  fn loaded_hook(&self, _piece: PieceId,
+                 _gs: &mut GameState, _ig: &InstanceRef) { }
 
   /// Not called if the whole game is destroyed.
   /// You can use Drop of course but it's not usually much use since
index 3cc573e27f63bb8dacdb564cdfa88f775986326b..a84449745e141aba6477c8bcdd070d5218e7ba80 100644 (file)
@@ -1120,7 +1120,7 @@ impl InstanceGuard<'_> {
 
     let ig = &mut *g;
     for (piece, ipc) in ig.ipieces.0.iter() {
-      ipc.direct_trait_access().loaded_hook(piece, &mut ig.gs)?;
+      ipc.direct_trait_access().loaded_hook(piece, &mut ig.gs, &gref)?;
     }
 
     for (token, _) in &tokens_players {