chiark / gitweb /
occult: Prevent restacking of occulting pieces (servr)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 15 Mar 2021 01:08:02 +0000 (01:08 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 15 Mar 2021 01:08:14 +0000 (01:08 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
daemon/api.rs
templates/script.ts

index 119711291e008e965289c575cc2ea9ede164ef53..54ac9947282c7fe4f020a8a86c5fa8304447f0cc 100644 (file)
@@ -363,9 +363,9 @@ api_route!{
   as:
   #[throws(ApiPieceOpError)]
   fn op(&self, a: ApiPieceOpArgs) -> PieceUpdate {
-    // xxx prevent restzcking anything that is occulting
     let ApiPieceOpArgs { gs,piece, .. } = a;
     let gpc = gs.pieces.byid_mut(piece).unwrap();
+    if gpc.occult.is_active() { throw!(OE::Occultation) }
     gpc.zlevel = ZLevel { z: self.z.clone(), zg: gs.gen };
     let update = PieceUpdateOp::SetZLevel(());
     (WhatResponseToClientOp::Predictable,
index 9ba638bb57982b9939624cd4ec82153dc91d5d85..f167d67e0d18e43232221b121e12d5de5e97a938 100644 (file)
@@ -719,6 +719,7 @@ function drag_mousedown(e : MouseEvent, shifted: boolean) {
       drag_add_piece(tpiece,tp);
     }
   } else if (held == null || wresting) {
+    // xxx prevent clicking on anything that is occulting, unless wresting
     if (!shifted) {
       ungrab_all();
     }