ExecuteGameChangeUpdates,
MgmtGameResponse,
UnpreparedUpdates, // These happena after everything else
+ Vec<MgmtGameInstruction>,
&'igr mut InstanceGuard<'ig>,
);
fn no_updates<'igr,'ig>(ig: &'igr mut InstanceGuard<'ig>,
mgr: MgmtGameResponse)
-> ExecuteGameInsnResults<'igr, 'ig> {
- (U{ pcs: vec![], log: vec![], raw: None }, mgr, None, ig)
+ (U{ pcs: vec![], log: vec![], raw: None }, mgr, None, vec![], ig)
}
#[throws(MgmtError)]
{
let (ig, _) = cs.check_acl(ag, ig, PCH::Instance, p)?;
let resp = f(ig)?;
- (U{ pcs: vec![], log: vec![], raw: None }, resp, None, ig)
+ (U{ pcs: vec![], log: vec![], raw: None }, resp, None, vec![], ig)
}
#[throws(MgmtError)]
(U{ log,
pcs: vec![],
raw: Some(vec![ PreparedUpdateEntry::SetLinks(ig.links.clone()) ])},
- Fine, None, ig)
+ Fine, None, vec![], ig)
}
impl<'cs> CommandStream<'cs> {
who, size.x(), size.y()),
}],
raw: Some(vec![ PreparedUpdateEntry::SetTableSize(size) ]) },
- Fine, None, ig)
+ Fine, None, vec![], ig)
}
MGI::SetTableColour(colour) => {
&who, &colour),
}],
raw: Some(vec![ PreparedUpdateEntry::SetTableColour(colour) ]) },
- Fine, None, ig)
+ Fine, None, vec![], ig)
}
MGI::JoinGame {
log: vec![ logentry ],
raw: Some(vec![ update ] )},
MGR::JoinGame { nick, player, token: atr },
- None, ig)
+ None, vec![], ig)
},
MGI::DeletePieceAlias(alias) => {
let ig = ig.by_mut(superuser.into());
let (gen, mgr) = some_synch_core(ig)?;
let log = LogEntry { html: synch_logentry(gen) };
- (U{ pcs: vec![], log: vec![log], raw: None }, mgr, None, ig)
+ (U{ pcs: vec![], log: vec![log], raw: None }, mgr, None, vec![], ig)
},
MGI::PieceIdLookupFwd { player, piece } => {
(U{ log,
pcs: vec![],
raw: None},
- Fine, None, ig)
+ Fine, None, vec![], ig)
},
MGI::Info => readonly(cs,ag,ig, &[TP::ViewNotSecret], |ig|{
(U{ pcs: vec![],
log: vec![ LogEntry { html }],
raw: Some(vec![ update ]) },
- Fine, None, ig)
+ Fine, None, vec![], ig)
},
MGI::DeletePiece(piece) => {
as SomeUnpreparedUpdates
)
} else { None },
+ vec![],
ig_g)
},
html: hformat!("{} added {} pieces", who, count_len),
}],
raw: None },
- Fine, None, ig_g)
+ Fine, None, vec![], ig_g)
},
MGI::ClearLog => {
html: hformat!("{} cleared the log history", who),
} ],
raw },
- Fine, None, ig)
+ Fine, None, vec![], ig)
},
MGI::SetACL { acl } => {
(U{ pcs: vec![ ],
log,
raw: Some(updates) },
- Fine, None, ig)
+ Fine, None, vec![], ig)
},
};
Ok(y)
cs: &'cs CommandStream,
ag: &mut AccountsGuard,
igu: &'igr mut Unauthorised<InstanceGuard<'ig>, InstanceName>,
- mut insns: Vec<MgmtGameInstruction>,
+ insns: Vec<MgmtGameInstruction>,
how: MgmtGameUpdateMode) -> MgmtResponse
{
let (ok, uu) = ToRecalculate::with(|mut to_permute| {
}
let mut uh_auth: Option<St> = None;
let flush_uh = |st: &mut St, igu: &'_ mut _| st.flushu(igu, how, &who);
+ let mut insns: VecDeque<_> = insns.into();
let res = (||{
- for insn in insns.drain(0..) {
+ while let Some(insn) = insns.pop_front() {
trace_dbg!("exeucting game insns", insn);
if_chain!{
}
let was_delete = matches!(&insn, MGI::DeletePiece(..));
- let (updates, resp, unprepared, ig) =
+ let (updates, resp, unprepared, expand, ig) =
execute_game_insn(cs, ag, igu, insn, &who,
&mut to_permute)?;
+ if ! expand.is_empty() {
+ let mut expand: VecDeque<_> = expand.into();
+ expand.append(&mut insns);
+ insns = expand;
+ }
let st = uh_auth.get_or_insert_with(||{
let auth = Authorisation::authorised(&*ig.name);
let uh = UpdateHandler::from_how(how);