chiark / gitweb /
hidden: Prevent occultation scrambling of grasped things
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 20 Mar 2021 23:26:55 +0000 (23:26 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 20 Mar 2021 23:26:55 +0000 (23:26 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/hidden.rs
src/vpid.rs

index 84b2248e6a8b4d85917fa38c9d11a4a621521396..9c1ea743eb6b4b985a23591449bb994339b5e127 100644 (file)
@@ -307,7 +307,6 @@ pub fn vpiece_decode(
 
 // xxx prevent addpiece and removepiece in places that would be occulted
 // xxx this means this only happens on ungrab I think ?
-// xxx prevent occultation scrambling of grasped things
 
 #[throws(InternalError)]
 fn recalculate_occultation_general<
index e17a0161b1139058cbe0816cf96b4f45c8ecd763..62e431c103ee8e62730a48184478b71e9f5860f7 100644 (file)
@@ -282,6 +282,8 @@ pub fn permute(occid: OccId,
 
     for (notch, nr) in occ.notches.table.iter_enumerated() {
       let piece = if let Some(p) = nr.piece() { p } else { continue };
+      let gpc = if let Some(gpc) = gpieces.get(piece) { gpc }else{ continue };
+      if gpc.held.is_some() { continue }
       let occilk = (|| Some(ipieces.get(piece)?.occilk.as_ref()?))();
       let occilk = if let Some(o) = occilk { *o.borrow() } else {
         error!("{}", internal_error_bydebug(&(occid, &occ, &nr, piece)));