let displace = OccDisplacement::Rect { rect };
let views = OwnerOccultationView {
owner: player,
- owner_view: OccK::Visible,
- defview: OccK::Displaced((displace, gpc.zlevel.z.clone())),
+ owner_view: OccKA::Visible,
+ defview: OccKA::Displaced((displace, gpc.zlevel.z.clone())),
}.views()?;
dbgc!("claiming got region", ®ion, &views);
Ok::<_,IE>((region, views))
}
pub type OccultationKind = OccultationKindGeneral<(OccDisplacement,ZCoord)>;
+#[derive(Clone,Debug)]
+#[derive(Eq,PartialEq,Hash)]
+pub enum OccultationKindAlwaysOk {
+ Visible,
+ // Scrambled is only allowed as the only view; enforced by our
+ // OccultationViewDef trait impls
+ Displaced((OccDisplacement,ZCoord)),
+ Invisible,
+}
+impl From<OccultationKindAlwaysOk> for OccultationKind {
+ fn from(i: OccultationKindAlwaysOk) -> OccultationKind {
+ match i {
+ OccKA::Visible => OccKG::Visible,
+ OccKA::Displaced(d) => OccKG::Displaced(d),
+ OccKA::Invisible => OccKG::Invisible,
+ }
+ }
+}
+
#[derive(Clone,Debug,Serialize,Deserialize)]
#[derive(Eq,PartialEq,Hash)]
pub enum OccDisplacement {
);
#[derive(Debug,Clone)]
pub struct OwnerOccultationView {
- pub defview: OccultationKind,
+ pub defview: OccultationKindAlwaysOk,
pub owner: PlayerId,
- pub owner_view: OccultationKind,
+ pub owner_view: OccultationKindAlwaysOk,
}
pub trait OccultationViewDef {
impl OccultationViewDef for OwnerOccultationView {
#[throws(IE)]
fn views(self) -> OccultationViews { OccultationViews {
- defview: self.defview,
+ defview: self.defview.into(),
views: vec![OccultView {
players: vec![self.owner],
- occult: self.owner_view,
+ occult: self.owner_view.into(),
}]
} }
}