From: Ian Jackson Date: Wed, 14 Jul 2021 15:17:45 +0000 (+0100) Subject: api: Support loose grab op X-Git-Tag: otter-0.7.2~93 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=76d079c012aeb5a81c76baa1f91c450eefc13c93;p=otter.git api: Support loose grab op Signed-off-by: Ian Jackson --- diff --git a/daemon/api.rs b/daemon/api.rs index 60643d5c..34646e32 100644 --- a/daemon/api.rs +++ b/daemon/api.rs @@ -283,6 +283,14 @@ api_route!{ } impl op::Core as { + #[throws(ApiPieceOpError)] + fn conflict_loose_check(&self, gpc: &GPiece, client: ClientId) + -> ContinueDespiteConflict { + if gpc.occult.is_active() { throw!(Ia::Occultation ) } + if gpc.moveable != PieceMoveable::Yes { throw!(Ia::PieceImmoveable) } + if gpc.last_released != client { throw!(Ia::PieceHeld ) } + ContinueDespiteConflict + } } impl op::Simple as {