chiark / gitweb /
updates: Replace *_nc functions, pass IsResponseToClientOp around
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 3 Apr 2021 16:58:19 +0000 (17:58 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 4 Apr 2021 02:45:09 +0000 (03:45 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
daemon/cmdlistener.rs
src/deck.rs
src/hand.rs
src/organise.rs
src/updates.rs

index 1b59a26b837863b76ab1411a2ee62062ee2a85e7..14aecf75f6b52b3ce1dbda56d6f4b57e9034600d 100644 (file)
@@ -667,7 +667,7 @@ fn execute_game_insn<'cs, 'igr, 'ig: 'igr>(
        if xupdates.len() != 0 {
          Some(
            Box::new(move |prepub: &mut PrepareUpdatesBuffer|
-                    prepub.piece_updates_nc(xupdates))
+                    prepub.piece_updates(xupdates, &None))
              as SomeUnpreparedUpdates
          )
        } else { None },
index ec0da91a831dc357fc7c6c929232030c1b1f0354..2e70570c819ca34782370855c66caf11bb45e911 100644 (file)
@@ -230,7 +230,7 @@ impl PieceTrait for Deck {
       wrc, log,
       ops: PUOs::Simple(PUO::Modify(())),
     },
-     xupdates.into_unprepared_nc())
+     xupdates.into_unprepared(None))
   }
 
   fn occultation_notify_hook(&self, piece: PieceId) -> UnpreparedUpdates {
index 7aff7793d896d48792535ac8b100833c275905e5..08804fcfefdca070e9159e6df0a0ce002c3607af 100644 (file)
@@ -321,6 +321,6 @@ impl PieceTrait for Hand {
     (PieceUpdate {
       wrc, log,
       ops: PUOs::Simple(PUO::Modify(())),
-    }, xupdates.into_unprepared_nc())
+    }, xupdates.into_unprepared(None))
   }
 }
index 2613428516ec3b98e52737324ede5f4ec1b50f52..9914f5a34bb8219d80e89dd6e55a991a230ed0ea 100644 (file)
@@ -299,6 +299,6 @@ pub fn ui_operation(a: &mut ApiPieceOpArgs<'_>, opname: &str,
       wrc: WRC::Predictable,
       log,
       ops: PUOs::PerPlayer(default()),
-    }, updates.into_unprepared_nc()))
+    }, updates.into_unprepared(None)))
   })() // <- no ?, shows it's infallible
 }
index ac7abedd83bab99d01535104001f08ead3b7bd80..f36d942be62e3dc16eb7ed0974794f4f5da2742a 100644 (file)
@@ -789,9 +789,11 @@ impl<'r> PrepareUpdatesBuffer<'r> {
     self.us.push(PUE::Image(PreparedUpdateEntry_Image { ims }))
   }
 
-  pub fn piece_updates_nc(&mut self, updates: Vec<(PieceId, PieceUpdateOps)>) {
+  pub fn piece_updates(&mut self,
+                       updates: Vec<(PieceId, PieceUpdateOps)>,
+                       by_client: &IsResponseToClientOp) {
     for (piece, ops) in updates {
-      self.piece_update(piece,&None, ops);
+      self.piece_update(piece, by_client, ops);
     }
   }
 
@@ -975,10 +977,11 @@ impl PreparedUpdate {
 
 #[ext(pub)]
 impl Vec<(PieceId, PieceUpdateOps)> {
-  fn into_unprepared_nc(self) -> UnpreparedUpdates {
+  fn into_unprepared(self, by_client: IsResponseToClientOp)
+                     -> UnpreparedUpdates {
     Some(Box::new(
       move |buf: &mut PrepareUpdatesBuffer| {
-        buf.piece_updates_nc(self)
+        buf.piece_updates(self, &by_client)
       }))
   }
 }