chiark / gitweb /
cmd updates: Do not restart PreparedUpdates if no actual xupdates
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 31 Mar 2021 16:34:00 +0000 (17:34 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 1 Apr 2021 10:37:38 +0000 (11:37 +0100)
In pravtice, the Delete command would otherwise always restart the
PreparedUpdates and this would defeat the Bulk update and make a game
reset very slow.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
daemon/cmdlistener.rs

index afc698e2010197ffa102448acc06cf9c40b270e6..459eee9cf4fc7251f86845ee1634fcec8304e7c0 100644 (file)
@@ -665,11 +665,13 @@ fn execute_game_insn<'cs, 'igr, 'ig: 'igr>(
           }],
           raw: None },
        Fine,
-       Some(
-         Box::new(move |prepub: &mut PrepareUpdatesBuffer|
-                  prepub.piece_updates(xupdates))
-           as SomeUnpreparedUpdates
-       ),
+       if xupdates.len() != 0 {
+         Some(
+           Box::new(move |prepub: &mut PrepareUpdatesBuffer|
+                    prepub.piece_updates(xupdates))
+             as SomeUnpreparedUpdates
+         )
+       } else { None },
        ig_g)
     },