#[throws(InternalError)]
fn try_layout(region: &Rect,
- pieces: &IndexVec<InHand, (PieceId, Rect)>,
+ pieces: &IndexVec<InHand, (Rect, PieceId)>,
att: Attempt)
-> Option<IndexVec<InHand, Pos>> {
let mut out = default();
// Everything below n_y is overwriteable
// Everything below and to the right of cur is overwriteable
- for (piece, bbox) in pieces {
+ for (bbox, piece) in pieces {
let place = 'placed: loop {
for xi in 0..3 {
let place = (cur - att.tl(&bbox)?)?;
if let Some(bbox) = want!( Ok = ipc.show(vis).bbox_approx(), ?piece );
then {
Some((
- (piece, bbox),
+ (bbox, piece),
gpc.zlevel.clone())
)
}
}
}).unzip::<
_,_,
- IndexVec<InHand, (PieceId, Rect)>,
+ IndexVec<InHand, (Rect, PieceId)>,
IndexVec<InHand, ZLevel>,
>();
let updates = {
let mut updates = Vec::with_capacity(pieces.len());
- for ((piece, _bbox), pos, zlevel) in izip!(pieces, layout, zlevels) {
+ for ((_bbox, piece), pos, zlevel) in izip!(pieces, layout, zlevels) {
want_let!{ Some(gpc) = gs.pieces.get_mut(piece); else continue; }
gpc.pos = pos;
gpc.zlevel = zlevel;