// kept in synch with Occultation::pieces
pub struct PieceOccult {
active: Option<OccId>, // kept in synch with Occultation::occulter
- passive: Option<(OccId, Notch, Generation)>, // kept in synch with Occultation::pieces
+ passive: Option<Passive>, // kept in synch with Occultation::pieces
+}
+
+#[derive(Clone,Copy,Debug,Serialize,Deserialize,Eq,PartialEq)]
+struct Passive {
+ occid: OccId,
+ notch: Notch,
+ zg: Generation,
}
#[derive(Clone,Debug,Serialize,Deserialize)]
new_notches[notch] = NR::Piece(new_piece);
gpieces.get_mut(new_piece).unwrap()
.occult.passive.as_mut().unwrap()
- .1
+ .notch
= notch;
}
}
) -> Option<PieceRenderInstructions>
{
let occk = if_chain! {
- if let Some((occid, notch, zg)) = gpc.occult.passive;
+ if let Some(Passive { occid, notch, zg }) = gpc.occult.passive;
if let Some(occultation) = occults.occults.get(occid);
then {
occultation.views.get_kind(player)
let occulteds = OldNewOcculteds {
old:
- gpc.occult.passive.map(|(occid, notch, _zg)| Ok::<_,IE>((
+ gpc.occult.passive.map(|Passive { occid, notch, zg:_zg }| Ok::<_,IE>((
Occulted {
occid,
occ: goccults.occults.get(occid).ok_or_else(
let zg = gen.next();
let notch = notches(goccults, occid)
.insert(zg, piece);
- Some((occid, notch, zg))
+ Some(Passive { occid, notch, zg })
} else {
None
};
gpieces
.iter()
.filter_map(|(ppiece, pgpc)| {
- if pgpc.occult.passive.map(|p| p.0) == Some(occid) { Some(ppiece) }
- else { None }
+ if pgpc.occult.passive.map(|p| p.occid) == Some(occid) {
+ Some(ppiece)
+ } else { None }
})
.collect()
};