use super::*;
pub trait Core: Debug {
- #[throws(Fatal)]
+ #[throws(Inapplicable)]
fn check_held(&self, pc: &GPiece, player: PlayerId) {
if pc.held != None && pc.held != Some(player) {
- throw!(Fatal::PieceHeld)
+ throw!(Ia::PieceHeld)
}
}
}
}
impl op::Core as {
- #[throws(Fatal)]
+ #[throws(Ia)]
fn check_held(&self, _pc: &GPiece, _player: PlayerId) { }
}
struct ApiPieceMove(Pos);
impl op::Core as {
- #[throws(Fatal)]
+ #[throws(Ia)]
fn check_held(&self, gpc: &GPiece, player: PlayerId) {
// This will ensure that occultations are (in general) properly
// updated, because the player will (have to) release the thing
// again
- if gpc.held != Some(player) { throw!(Fatal::PieceHeld) }
- if gpc.occult.is_active() { throw!(OE::Occultation) }
+ if gpc.held != Some(player) { throw!(Ia::PieceNotHeld) }
+ if gpc.occult.is_active() { throw!(Ia::Occultation) }
if matches_doesnot!(
gpc.moveable(),
= PieceMoveable::No,
! PieceMoveable::Yes | PieceMoveable::IfWresting,
- ) { throw!(OE::PieceImmoveable) }
+ ) { throw!(Ia::PieceImmoveable) }
}
}
#[derive(Error,Debug,Serialize,Copy,Clone)]
pub enum Inapplicable {
- #[error("simultaneous update")] Conflict,
- #[error("position off table")] PosOffTable,
- #[error("piece gone")] PieceGone,
- #[error("prevented by occultation")] Occultation,
- #[error("piece may not be rotated")] PieceUnrotateable,
- #[error("occulter already rotated")] OcculterAlreadyRotated,
- #[error("overfull, cannot organise")] OrganisedPlacementOverfull,
+ #[error("simultaneous update")] Conflict,
+ #[error("position off table")] PosOffTable,
+ #[error("piece gone")] PieceGone,
+ #[error("piece held by another player")] PieceHeld,
+ #[error("piece not held by your")] PieceNotHeld,
+ #[error("prevented by occultation")] Occultation,
+ #[error("piece may not be rotated")] PieceUnrotateable,
+ #[error("piece may not be moved")] PieceImmoveable,
+ #[error("occulter already rotated")] OcculterAlreadyRotated,
+ #[error("overfull, cannot organise")] OrganisedPlacementOverfull,
}
pub type StartupError = anyhow::Error;