if gpc.held != None { throw!(Ia::PieceHeld) }
if ! (self.z > gpc.zlevel.z) { throw!(Ia::BadPieceStateForOperation); }
op_do_set_z(gpc, a.gs.gen, &self.z)?;
- a.ipc.show(y).op_multigrab(a, pri, self.n, &self.z).map_err(|e| match e {
+ a.ipc.show(y).op_multigrab(a, y, self.n, &self.z).map_err(|e| match e {
// TODO: The error handling is wrong, here. If op_multigrab
// returns a deferred thunk, the APOE::PartiallyProcessed will
// not be applked.
}
#[throws(ApiPieceOpError)]
- fn op_multigrab(&self, _: ApiPieceOpArgs, _: PieceRenderInstructions,
+ fn op_multigrab(&self, _: ApiPieceOpArgs, show: ShowUnocculted,
take: MultigrabQty, new_z: &ZCoord) -> OpOutcomeThunk {
let currency = self.currency.clone();
let new_z = new_z.clone();
OpOutcomeThunk::Reborrow(Box::new(
move |ig: &mut InstanceGuard, player: PlayerId, tpiece: PieceId|
{
- ig.fastsplit_split(player, tpiece, new_z,
+ ig.fastsplit_split(player, tpiece, show, new_z,
move |ioccults: &IOccults, goccults: &GameOccults, gpl: &GPlayer,
- tgpc: &mut GPiece, tipc: &IPiece,
+ tgpc: &mut GPiece, tipc: &IPiece, _tipc_p: &dyn PieceTrait,
ngpc: &mut GPiece|
{
let tgpc_value: &mut Value = tgpc.xdata.get_mut_exp()?;
#[throws(ApiPieceOpError)]
pub fn fastsplit_split<I>(
&mut self, player: PlayerId,
- tpiece: PieceId, new_z: ZCoord,
+ tpiece: PieceId, show: ShowUnocculted, new_z: ZCoord,
implementation: I
) -> UpdateFromOpComplex
where I: FnOnce(&IOccults, &GameOccults, &GPlayer,
- &mut GPiece, &IPiece, &mut GPiece)
+ &mut GPiece, &IPiece, &dyn PieceTrait,
+ &mut GPiece)
-> Result<UpdateFromOpComplex, ApiPieceOpError>
{
// The "save later" part of this ought to be unnecessarily, because
fastsplit: tgpc.fastsplit,
};
+ let tipc_p = (||{
+ let p = tipc.p.show(show);
+ let p: &Piece = p.downcast_ref::<Piece>()?;
+ let p = p.ipc.as_ref()?.p.show(show);
+ Some(p)
+ })().ok_or_else(|| internal_error_bydebug(tipc))?;
+
let (t_pu, t_unprepared) = implementation(
&ig.ioccults, &ig.gs.occults, gpl,
- tgpc, tipc,
+ tgpc, tipc, tipc_p,
&mut ngpc
)?;
// one will do.
//
// So the multigrab operation specifies a ZCoord.
- fn op_multigrab(&self, _a: ApiPieceOpArgs, _pri: PieceRenderInstructions,
+ fn op_multigrab(&self, _a: ApiPieceOpArgs, _show: ShowUnocculted,
_qty: MultigrabQty, _new_z: &ZCoord)
-> Result<OpOutcomeThunk,ApiPieceOpError> {
Err(Ia::BadPieceStateForOperation)?