match y {
Some(y) => Left(y),
None => Right({
- let occilk = self.occilk.as_ref()
- .ok_or_else(|| internal_logic_error(format!(
- "occulted non-occultable {:?}", self)))?;
+ if_let!{ Some(occilk) = self.occilk.as_ref();
+ else return Ok(Left(ShowUnocculted::new_visible())); }
let occ_data = ioccults.ilks.from_iilk(occilk)
.ok_or_else(|| internal_logic_error(format!(
"occulted ilk vanished {:?} {:?}", self, occilk)))?;
// prevent occulting pieces being occulted
// (also prevents reflexive occultation)
return None
- } else if ipc.occilk.is_none() {
- // if we cannot make it look identical to the others, we
- // cannot occult it beause we can't hide its identity
- return None
} else if occ.in_region(gpc.pos) {
Some(Occulted { occid, occ })
} else {
if let Some(occid) = occulteds.new;
let zg = gen.next();
let occ = occultation(goccults, occid);
- if let Some(ilk) = wants!( ipc.occilk.as_ref() );
+ let ilk = ipc.occilk.as_ref();
then {
let permute_notch = match ilk {
- IOI::Distinct(_) => {
+ Some(IOI::Distinct(_)) | None => {
occ.unnotched.insert(piece);
None
},
- IOI::Mix(ilk) => {
+ Some(IOI::Mix(ilk)) => {
if_chain!{
if occ.notches.is_empty();
if let Some(ilk) = wants!( ioccults.ilks.get(ilk) );
st.recurse();
}
-pub fn permute(occid: OccId,
+pub fn permute(_occid: OccId,
occ: &mut Occultation,
gplayers: &mut GPlayers,
gpieces: &mut GPieces,
if_let!{ Some(gpc) = gpieces.get(piece); else continue }
if gpc.held.is_some() { continue }
let occilk = (|| Some(ipieces.get(piece)?.occilk.as_ref()?))();
- if_let!{ Some(occilk) = occilk; else {
- error!("{}", internal_error_bydebug(&(occid, &occ, &nr, piece)));
- continue;
- }}
+ if_let!{ Some(occilk) = occilk; else { continue; }}
if_let!{ IOI::Mix(occilk) = occilk; else continue; }
let (notches, pieces) = ilks.entry(*occilk.borrow()).or_default();
notches.push(notch);