if let Some(pinfo) = ig.ipieces.get(piece);
let desc_html = pinfo.describe_html_infallible(None, p);
let itemname = pinfo.itemname().to_string();
- let bbox = pinfo.bbox_approx();
+ let bbox = pinfo.bbox_approx()?;
let visible = if ! piece_at_all_occluded(&ig.gs.occults, piece) {
Some(MgmtGamePieceVisibleInfo {
pos, face, desc_html, bbox
let spec = spec.clone();
let bbox = pc
- .bbox_approx();
+ .bbox_approx()?;
let mut bbox = bbox
.iter()
.map(|PosC(xy)| xy.iter().map(|&p| p as f64).collect::<Vec<_>>())
}
fn thresh_dragraise(&self, pri: &PieceRenderInstructions)
-> Result<Option<Coord>, IE>;
- fn bbox_approx(&self) -> [Pos;2];
+ fn bbox_approx(&self) -> Result<[Pos;2], IE>;
}
#[derive(Debug,Copy,Clone,Serialize,Deserialize)]
-> Result<Html,IE>;
fn thresh_dragraise(&self, _pri: &PieceRenderInstructions)
-> Result<Option<Coord>,IE>;
- fn bbox_approx(&self) -> [Pos;2];
+ fn bbox_approx(&self) -> Result<[Pos;2], IE>;
}
}
}
-> Result<Html,IE>;
fn thresh_dragraise(&self, _pri: &PieceRenderInstructions)
-> Result<Option<Coord>,IE>;
- fn bbox_approx(&self) -> [Pos;2];
+ fn bbox_approx(&self) -> Result<[Pos;2], IE>;
}
}
}
-> Result<Html, IE>;
fn thresh_dragraise(&self, pri: &PieceRenderInstructions)
-> Result<Option<Coord>, IE>;
- fn bbox_approx(&self) -> [Pos; 2];
+ fn bbox_approx(&self) -> Result<[Pos; 2], IE>;
}}}
#[typetag::serde(name="Lib")]
e@ Err(_) => e?,
Ok(r) => r,
};
- let f0bbox = loaded.bbox_approx();
+ let f0bbox = loaded.bbox_approx()?;
let ier = ItemEnquiryData {
itemname: k.clone(),
f0bbox,
fn thresh_dragraise(&self, _pri: &PieceRenderInstructions) -> Option<Coord> {
Some((self.diam * 0.5) as Coord)
}
+ #[throws(IE)]
fn bbox_approx(&self) -> [Pos;2] {
let d = (self.diam * 0.5).ceil() as Coord;
[PosC([-d,-d]), PosC([d, d])]
.map(OrderedFloat::from).min().unwrap().into();
Some((smallest * 0.5) as Coord)
}
+ #[throws(IE)]
fn bbox_approx(&self) -> [Pos;2] {
let pos: Pos = self.xy.map(
|v| ((v * 0.5).ceil()) as Coord