From: Ian Jackson Date: Sat, 13 Mar 2021 20:39:43 +0000 (+0000) Subject: at-otter hidden: Introduce api_piece_move_synch X-Git-Tag: otter-0.4.0~90 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=e67ba74d1db87b37339dec875221fcba455f6d7e;p=otter.git at-otter hidden: Introduce api_piece_move_synch Signed-off-by: Ian Jackson --- diff --git a/apitest/at-otter.rs b/apitest/at-otter.rs index b59095c3..ec4f467e 100644 --- a/apitest/at-otter.rs +++ b/apitest/at-otter.rs @@ -286,6 +286,14 @@ impl Session { self.api_piece_op(piece, "ungrab", json!({}))?; } + #[throws(AE)] + fn api_piece_move_synch( + &mut self, pieces: &mut Pieces, i: PI, pos: Pos + ) { + pieces[i].pos = pos; + self.api_with_piece_op_synch(pieces, i, "m", json![pos.0])?; + } + #[throws(AE)] fn await_update< R, @@ -514,8 +522,7 @@ impl Ctx { for (xi, &p) in a_pawns.iter().enumerate().take(1) { let xix: Coord = xi.try_into().unwrap(); let pos = PosC([ (xix + 1) * 15, 20 ]); - a_pieces[p].pos = pos; - alice.api_with_piece_op_synch(&mut a_pieces, p, "m", json![pos.0])?; + alice.api_piece_move_synch(&mut a_pieces, p, pos)?; } alice.synchu(&mut a_pieces)?;