From: Ian Jackson Date: Wed, 31 Mar 2021 16:34:00 +0000 (+0100) Subject: cmd updates: Do not restart PreparedUpdates if no actual xupdates X-Git-Tag: otter-0.5.0~352 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=eac4c1211076ac8504851d0b7efd532ef91e559a;p=otter.git 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 --- 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) },