chiark / gitweb /
hidden: add some dbgc!
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 7 Mar 2021 10:59:11 +0000 (10:59 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 7 Mar 2021 10:59:26 +0000 (10:59 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/hand.rs
src/hidden.rs

index bcdf0e43cd7b8605d7792b0877d95dab95977fd5..175d10d333232badbae8dadc589c80067c0ef038 100644 (file)
@@ -213,12 +213,15 @@ impl PieceTrait for Hand {
 
     let log = vec![ LogEntry { html: Html(format!("{} {}", nick.0, did)) }];
 
+    dbgc!("ui op k did main");
+    
     // We need to reaquire mut references because create_occultation etc.
     // need mut access to gpieces.
     let gpc = gpieces.byid_mut(piece).expect("piece disappeared");
     let xdata = gpc.xdata.get_mut::<HandState>().expect("xdata disappeared!");
     assert_eq!(xdata.player(), old_player);
 
+    dbgc!("thinging done", &xdata, &new_owner);
     xdata.owner = new_owner;
 
     (PieceUpdate {
index b8a6649194e079330e536d69309c2131d23d3b83..4a6b1e5cfedcdce9283912b907769f1ec2dedfb6 100644 (file)
@@ -405,6 +405,7 @@ fn inner(
   piece: PieceId, gpc: &GPiece, _p: &dyn PieceTrait,
 ) -> Option<PieceRenderInstructions>
 {
+  dbgc!(&gpc);
   let vpid = gpl.idmap.fwd_or_insert(piece);
   let angle = gpc.angle;
   let occulted = PriOcculted::Visible; // xxx
@@ -454,8 +455,8 @@ pub fn massage_prep_piecestate(
 
 #[throws(InternalError)]
 fn recalculate_occultation_general<
-  RD,                                                 // return data
-  LD,                                                 // log data
+  RD: Debug,                                          // return data
+  LD: Debug,                                          // log data
   VF: FnOnce(LD) -> RD,                               // ret_vanilla
   LF: FnOnce(Html, Html, Option<&Html>) -> LD,        // log_callback
   RF: FnOnce(PieceUpdateOps_PerPlayer, LD) -> RD,     // ret_callback
@@ -522,7 +523,7 @@ fn recalculate_occultation_general<
 
       new:
         goccults.occults.iter().find_map(|(occid, occ)| {
-          dbg!(if gpc.pinned {
+          if gpc.pinned {
             // Prevent pinned pieces being occulted.  What scrambling
             // them etc. would mean is not entirely clear.
             return None
@@ -534,9 +535,11 @@ fn recalculate_occultation_general<
             Some(Occulted { occid, occ })
           } else {
             None
-          })
+          }
         }),
     };
+    dbgc!((piece, occulteds));
+
     let occids = occulteds.main().map(|h| h.as_ref().map(|occ| occ.occid));
     if occids.old() == occids.new() { return ret_vanilla(log_visible); }
 
@@ -564,6 +567,8 @@ fn recalculate_occultation_general<
         .push(player);
     }
 
+    dbgc!(&situations);
+
     let mut puos = SecondarySlotMap::new();
     let mut most_obscure = None;
 
@@ -584,6 +589,7 @@ fn recalculate_occultation_general<
         (true,  false) => Some(PUO::Delete()),
         (true,  true ) => Some(PUO::Modify(())),
       };
+      dbgc!(&kinds, &players, &most_obscure, &puo);
 
       if let Some(puo) = puo {
         for player in players {
@@ -591,6 +597,7 @@ fn recalculate_occultation_general<
         }
       }
     }
+    dbgc!(most_obscure);
 
     let describe_occulter = |oni| {
       let h = occulteds.as_refs().main()[oni];
@@ -629,6 +636,8 @@ fn recalculate_occultation_general<
     (puos, log, occulteds.map(|h| h.occid))
   };
   
+
+  dbgc!(&puos, &log, &occulteds);
   // point of no return
 
   // xxx shuffle some players' ids
@@ -821,6 +830,7 @@ pub fn create_occultation(
     notches: default(),
   };
   debug!("creating occultation {:?}", &occultation);
+  dbgc!(&recalc);
 
   // Everything from here on must be undone if we get an error
   // but we hope not to get one...
@@ -854,6 +864,7 @@ pub fn create_occultation(
     to_recompute.implement(gplayers, gpieces, goccults, ipieces),
   ))?;
 
+  dbgc!(&updates);
   updates
 }