#[throws(IE)]
pub fn prep_piecestate(&self, ioccults: &IOccults,
ipc: &IPiece, pri: &PieceRenderInstructions)
- -> PreparedPieceState {
+ -> PreparedPieceState {
+ use PriOcculted as PO;
+ let (pos, zlevel) = match &pri.occulted {
+ PO::Visible | PO::Occulted => (self.pos, self.zlevel.clone()),
+ PO::Displaced(pos, zlevel) => (*pos, zlevel.clone()),
+ };
PreparedPieceState {
- pos : self.pos,
+ pos : pos,
held : self.held,
svg : pri.make_defs(ioccults, self, ipc)?,
- z : self.zlevel.z.clone(),
- zg : self.zlevel.zg,
+ z : zlevel.z,
+ zg : zlevel.zg,
angle : pri.angle(self).to_compass(),
pinned : self.pinned,
uos : pri.ui_operations(self, ipc.p.borrow())?,
piece
}
-pub fn massage_prep_piecestate(
- _pri: &PieceRenderInstructions, // xxx
- _ns: &mut PreparedPieceState, // xxx
-) {
- // xxx hidden position involves adjusting pos and z and ??? here
-}
-
// xxx prevent addpiece and removepiece in places that would be occulted
// xxx this means this only happens on ungrab I think ?
// xxx prevent occultation scrambling of grasped things
let op = op.try_map(
|()|{
- let mut ns = pc.prep_piecestate(ioccults, ipc, pri)?;
- massage_prep_piecestate(pri, &mut ns);
+ let ns = pc.prep_piecestate(ioccults, ipc, pri)?;
<Result<_,InternalError>>::Ok(ns)
},
|()|{