From: Ian Jackson Date: Mon, 15 Mar 2021 01:09:07 +0000 (+0000) Subject: occult: Prevent moving occulting pieces (servr) X-Git-Tag: otter-0.4.0~34 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=d1671eb9b9ceee7b3f22938aeaa150cffc55bf51;p=otter.git occult: Prevent moving occulting pieces (servr) Signed-off-by: Ian Jackson --- diff --git a/daemon/api.rs b/daemon/api.rs index 54ac9947..9b88e294 100644 --- a/daemon/api.rs +++ b/daemon/api.rs @@ -379,14 +379,12 @@ api_route!{ impl op::Core as { #[throws(OnlineError)] - fn check_held(&self, pc: &GPiece, player: PlayerId) { + fn check_held(&self, gpc: &GPiece, player: PlayerId) { // This will ensure that occultations are (in general) properly // updated, because the player will (have to) release the thing // again - if pc.held != Some(player) { - throw!(OnlineError::PieceHeld) - } - // xxx prevent moving anything that is occulting + if gpc.held != Some(player) { throw!(OnlineError::PieceHeld) } + if gpc.occult.is_active() { throw!(OE::Occultation) } } }