pub trait InertPieceTrait: PieceBaseTrait {
/// When used for occultated version of another object,
/// face used is always default, regardless of nfaces.
- fn svg(&self, f: &mut Html, id: VisiblePieceId, face: FaceId)
- -> Result<(),IE>;
+ fn svg(&self, f: &mut Html, id: VisiblePieceId, face: FaceId,
+ xdata: &PieceXDataState /* use with care! */) -> Result<(),IE>;
fn describe_html(&self) -> Result<Html,IE>;
}
#[typetag::serde(name="Lib")]
impl InertPieceTrait for ItemInertForOcculted {
#[throws(IE)]
- fn svg(&self, f: &mut Html, _: VisiblePieceId, face: FaceId) {
+ fn svg(&self, f: &mut Html, _: VisiblePieceId, face: FaceId,
+ _: &PieceXDataState) {
if face != FaceId::default() {
throw!(internal_logic_error("ItemInertForOcculted non-default face"))
}
impl Item {
#[throws(IE)]
- fn svg_face(&self, f: &mut Html, face: FaceId, vpid: VisiblePieceId) {
+ fn svg_face(&self, f: &mut Html, face: FaceId, vpid: VisiblePieceId,
+ xdata: &PieceXDataState) {
if let Some(face) = self.faces.get(face) {
let svgd = &self.svgs[face.svg];
face.xform.write_svgd(f, svgd)?;
} else if let Some(back) = &self.back {
- back.svg(f, vpid, default())?;
+ back.svg(f, vpid, default(), &xdata)?;
} else {
throw!(internal_error_bydebug(&(self, face)))
}
#[throws(IE)]
fn svg_piece(&self, f: &mut Html, gpc: &GPiece,
_gs: &GameState, vpid: VisiblePieceId) {
- self.svg_face(f, gpc.face, vpid)?;
+ self.svg_face(f, gpc.face, vpid, &gpc.xdata)?;
}
#[throws(IE)]
fn describe_html(&self, gpc: &GPiece, _goccults: &GameOccults) -> Html {
#[typetag::serde(name="LibItem")]
impl InertPieceTrait for Item {
#[throws(IE)]
- fn svg(&self, f: &mut Html, id: VisiblePieceId, face: FaceId) {
- self.svg_face(f, face, id)?;
+ fn svg(&self, f: &mut Html, id: VisiblePieceId, face: FaceId,
+ xdata: &PieceXDataState) {
+ self.svg_face(f, face, id, xdata)?;
}
#[throws(IE)]
fn describe_html(&self) -> Html {