From d1671eb9b9ceee7b3f22938aeaa150cffc55bf51 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 15 Mar 2021 01:09:07 +0000 Subject: [PATCH] occult: Prevent moving occulting pieces (servr) Signed-off-by: Ian Jackson --- daemon/api.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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) } } } -- 2.30.2