From eac4c1211076ac8504851d0b7efd532ef91e559a Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 31 Mar 2021 17:34:00 +0100 Subject: [PATCH] cmd updates: Do not restart PreparedUpdates if no actual xupdates 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 --- daemon/cmdlistener.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/daemon/cmdlistener.rs b/daemon/cmdlistener.rs index afc698e2..459eee9c 100644 --- a/daemon/cmdlistener.rs +++ b/daemon/cmdlistener.rs @@ -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) }, -- 2.30.2