From: Ian Jackson Date: Wed, 7 Apr 2021 18:17:49 +0000 (+0100) Subject: Prevent use of organise function when rotated X-Git-Tag: otter-0.5.0~132 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=75542c4e011c86fecd7411ff960f6d81c2a546a7;p=otter.git Prevent use of organise function when rotated Add the proof token to the organise function, and check it in hand. This only currently makes any difference for player labels, because the other kinds of hand are unrotateable from load time. Because we don't update uos on rotation, the player can try to organise a rotated player label, but they will get an error. Signed-off-by: Ian Jackson --- diff --git a/src/hand.rs b/src/hand.rs index 2b10686a..14597a1a 100644 --- a/src/hand.rs +++ b/src/hand.rs @@ -223,10 +223,11 @@ impl PieceTrait for Hand { -> UpdateFromOpComplex { if let Some(r) = { let gpc = a.gs.pieces.byid_mut(a.piece)?; + let rot_checked = gpc.occulter_check_unrotated(vis)?; let rect = self.shape.outline.rect(gpc.pos) .map_err(|CoordinateOverflow| internal_error_bydebug(&(&gpc.pos, &self.shape)))?; - organise::ui_operation(&mut a, opname, wrc, &rect)? + organise::ui_operation(&mut a, rot_checked, opname, wrc, &rect)? } { return r; } diff --git a/src/organise.rs b/src/organise.rs index 60e3331e..fc89c246 100644 --- a/src/organise.rs +++ b/src/organise.rs @@ -230,8 +230,8 @@ fn try_layout(region: &Rect, #[throws(ApiPieceOpError)] -pub fn ui_operation(a: &mut ApiPieceOpArgs<'_>, opname: &str, - _wrc: WhatResponseToClientOp, region: &Rect) +pub fn ui_operation(a: &mut ApiPieceOpArgs<'_>, _: OcculterRotationChecked, + opname: &str, _wrc: WhatResponseToClientOp, region: &Rect) -> Option { let do_sort = match opname { "organise" => false,