let was_held = gs.pieces.get(piece).as_ref().map(|gpc| gpc.held);
match (||{
- let ipc = ipieces.get(piece).ok_or(POE::PieceGone)?;
+ let ipc = ipieces.get(piece).ok_or(Ia::PieceGone)?;
let gpc = gs.pieces.byid_mut(piece)?;
let q_gen = form.gen;
let gpl = players.byid_mut(player)?;
let pri = piece_pri(ioccults, &gs.occults, player, gpl, piece, gpc, ipc)
- .ok_or(POE::PieceGone)?;
+ .ok_or(Ia::PieceGone)?;
let pcs = pri.describe(ioccults,&gs.occults, gpc, ipc);
ioccults,&gs.occults,gpl,gpc,ipc,
"released"
)?;
- let who_by = who_by.ok_or(POE::PieceGone)?;
+ let who_by = who_by.ok_or(Ia::PieceGone)?;
if gpc.held != Some(player) { throw!(Fatal::PieceHeld) }
gpc.held = None;
let ApiPieceOpArgs { gs,ioccults,player,piece,ipc, .. } = a;
let gpc = gs.pieces.byid_mut(piece).unwrap();
if ! gpc.rotateable() || gpc.occult.is_active() {
- throw!(POE::PieceUnrotateable)
+ throw!(Ia::PieceUnrotateable)
}
let gpl = gs.players.byid_mut(player).unwrap();
let logents = log_did_to_piece(
player, gs.players.byid_mut(player)?,
piece, gs.pieces.byid(piece)?,
ipc)
- .ok_or(POE::PieceGone)?;
+ .ok_or(Ia::PieceGone)?;
let y = {
use PriOG::*;
match pri.occulted {
}
impl IdForById for PieceId {
- type Error = POE;
- const ERROR: POE = POE::PieceGone;
+ type Error = Ia;
+ const ERROR: Ia = Ia::PieceGone;
}
#[macro_export]
type Id = PieceId;
type Entry = GPiece;
type Error = Inapplicable;
- #[throws(POE)]
+ #[throws(Ia)]
fn byid(&self, piece: PieceId) -> &GPiece {
- self.get(piece).ok_or(POE::PieceGone)?
+ self.get(piece).ok_or(Ia::PieceGone)?
}
- #[throws(POE)]
+ #[throws(Ia)]
fn byid_mut(&mut self, piece: PieceId) -> &mut GPiece {
- self.get_mut(piece).ok_or(POE::PieceGone)?
+ self.get_mut(piece).ok_or(Ia::PieceGone)?
}
}
pub fn occulter_check_unrotated(&self, _:ShowUnocculted)
-> Result<OcculterRotationChecked, Inapplicable> {
- if self.angle.is_rotated() { Err(POE::OcculterAlreadyRotated) }
+ if self.angle.is_rotated() { Err(Ia::OcculterAlreadyRotated) }
else { Ok(OcculterRotationChecked(())) }
}
// This algorithm is quadratic. 320^2 = 102K
let len = pieces.len();
- if len > 320 { throw!(POE::OrganisedPlacementOverfull) }
+ if len > 320 { throw!(Ia::OrganisedPlacementOverfull) }
let mut remain: Vec<InHand> = (0..len).map(Into::into).collect();
let mut out = index_vec![];
for &pos in &layout {
// Some sanity checks
pos.clamped(gs.table_size).map_err(
- |_| APOE::Inapplicable(POE::PosOffTable))?;
+ |_| APOE::Inapplicable(Ia::PosOffTable))?;
match gs.occults.pos_occulter(&gs.occults, pos)? {
None => {},
Some(occulter) if occulter == apiece => {},
- Some(_) => throw!(APOE::Inapplicable(POE::Occultation)),
+ Some(_) => throw!(APOE::Inapplicable(Ia::Occultation)),
};
}
pub type ESVU<POEPU> = ErrorSignaledViaUpdate<POEPU>;
pub type IE = InternalError;
pub type OE = Fatal; // xxx get rid of this alyas when we've cleaned up Fatal
-pub type POE = Inapplicable; // xxx rename this alias
+pub type Ia = Inapplicable;
pub type POEPP = PieceOpErrorPartiallyProcessed;
pub type SvgE = SVGProcessingError;
pub type SpE = SpecError;