From: Ian Jackson Date: Sat, 20 Mar 2021 15:08:23 +0000 (+0000) Subject: Add an UnpreparedUpdates to PieceUpdateFromOpComplex X-Git-Tag: otter-0.5.0~671 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=c5c10ada744afdddd7893413005d277dd994c862;p=otter.git Add an UnpreparedUpdates to PieceUpdateFromOpComplex Signed-off-by: Ian Jackson --- diff --git a/daemon/api.rs b/daemon/api.rs index 50e8e94c..907c71f6 100644 --- a/daemon/api.rs +++ b/daemon/api.rs @@ -60,7 +60,7 @@ mod op { impl Complex for T where T: Core + Simple { #[throws(ApiPieceOpError)] fn op_complex(&self, a: ApiPieceOpArgs) -> UpdateFromOpComplex { - (self.op(a)?, vec![]) + (self.op(a)?, vec![], None) } } } @@ -162,7 +162,7 @@ fn api_piece_op(form: Json>) warn!("api_piece_op ERROR {:?}: {:?}", &form, &err); Err(err)?; }, - Ok((PieceUpdate { wrc, log, ops }, updates)) => { + Ok((PieceUpdate { wrc, log, ops }, updates, unprepared)) => { let mut buf = PrepareUpdatesBuffer::new(g, Some((wrc, client, form.cseq)), Some(1 + log.len())); @@ -170,6 +170,7 @@ fn api_piece_op(form: Json>) buf.piece_update(piece, ops); buf.piece_updates(updates); buf.log_updates(log); + if let Some(unprepared) = unprepared { unprepared(&mut buf); } debug!("api_piece_op OK: {:?}", &form); } @@ -519,7 +520,7 @@ api_route!{ wrc, PieceUpdateOp::Modify(()), logents, - ).into(), vec![]) + ).into(), vec![], None) }, _ => break, diff --git a/src/hand.rs b/src/hand.rs index 755a95d8..b5829107 100644 --- a/src/hand.rs +++ b/src/hand.rs @@ -240,6 +240,6 @@ impl PieceTrait for Hand { wrc, log, ops: PUOs::Simple(PUO::Modify(())), // xxx // xxx want PUU::RecalculateOccultations - }, xupdates) + }, xupdates, None) } } diff --git a/src/updates.rs b/src/updates.rs index 265ae6a5..4caeb894 100644 --- a/src/updates.rs +++ b/src/updates.rs @@ -150,7 +150,11 @@ pub enum PieceUpdateOp { SetZLevel(ZL), } -pub type UpdateFromOpComplex = (PieceUpdate, Vec<(PieceId, PieceUpdateOps)>); +pub type UpdateFromOpComplex = ( + PieceUpdate, + Vec<(PieceId, PieceUpdateOps)>, + UnpreparedUpdates, +); pub type PieceUpdateFromOpSimple = ( WhatResponseToClientOp,