chiark / gitweb /
Provide &InstanceRef in ApiPieceOpArgs
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 20 Mar 2021 18:29:43 +0000 (18:29 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 20 Mar 2021 19:51:57 +0000 (19:51 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
daemon/api.rs
src/gamestate.rs

index 907c71f6ba2441fa18cb0c549015af43e885977b..8de3728450501ad98adf8d0ff308875a16aab44c 100644 (file)
@@ -105,7 +105,7 @@ fn api_piece_op<O: op::Complex>(form: Json<ApiPiece<O>>)
   let mut ig = iad.gref.lock()?;
   ig.save_game_later();
 
-  ToPermute::with(move |mut to_permute| {
+  ToPermute::with(|mut to_permute| {
     let r = (||{
 
   let g = &mut *ig;
@@ -140,6 +140,7 @@ fn api_piece_op<O: op::Complex>(form: Json<ApiPiece<O>>)
     let update =
       form.op.op_complex(ApiPieceOpArgs {
         ioccults, gs, player, piece, ipieces, ipc,
+        ig: &iad.gref,
         to_permute: &mut to_permute,
       })?;
     Ok::<_,ApiPieceOpError>(update)
index 7768107be4fba8986ddf275626ca790bb5a6c344..ad1ca4b81970ce81e4e85730444abfe69238f096 100644 (file)
@@ -169,6 +169,7 @@ pub trait OccultedPieceTrait: OutlineTrait + 'static {
 
 #[derive(Debug)]
 pub struct ApiPieceOpArgs<'a> {
+  pub ig: &'a InstanceRef,
   pub gs: &'a mut GameState,
   pub ipieces: &'a IPieces,
   pub ioccults: &'a IOccults,