use std::cell::Cell;
type E = anyhow::Error;
-type Insn = MgmtGameInstruction; // xxx MGI
+type MGI = MgmtGameInstruction;
type AS = AccountScope;
type APE = ArgumentParseError;
type TP = TablePermission;
];
#[throws(AE)]
-fn setup_table(_ma: &MainOpts, spec: &TableSpec) -> Vec<Insn> {
+fn setup_table(_ma: &MainOpts, spec: &TableSpec) -> Vec<MGI> {
let TableSpec { players, player_perms, acl } = spec;
let mut player_perms = player_perms.clone()
.unwrap_or(PLAYER_DEFAULT_PERMS.iter().cloned().collect());
let acl = acl.try_into()?;
let mut insns = vec![];
- insns.push(Insn::ClearLog);
- insns.push(Insn::SetACL { acl });
+ insns.push(MGI::ClearLog);
+ insns.push(MGI::SetACL { acl });
insns
}
if ma.verbose >= 1 {
eprintln!("removing old player {:?}", &nick);
}
- insns.push(Insn::RemovePlayer { player: st.id });
+ insns.push(MGI::RemovePlayer { player: st.id });
}
let mut added_players = vec![];
}
if let Some(size) = game.table_size {
- insns.push(Insn::SetTableSize(size));
+ insns.push(MGI::SetTableSize(size));
}
let mut game = game;
for pspec in game.pieces.drain(..) {
- insns.push(Insn::AddPieces(pspec));
+ insns.push(MGI::AddPieces(pspec));
}
chan.alter_game(insns, None)?;
#[derive(Debug)]
enum Situation {
- Poor(Vec<Insn>, &'static str),
+ Poor(Vec<MGI>, &'static str),
Good([Pos; 2]),
};
use Situation::*;
pinned: Some(false),
info: Box::new(spec),
};
- Poor(vec![ Insn::AddPieces(spec) ],
+ Poor(vec![ MGI::AddPieces(spec) ],
"marker(s) created")
} else if markers.len() > WANTED {
let insns = markers[WANTED..].iter()
- .map(|p| Insn::DeletePiece(p.piece))
+ .map(|p| MGI::DeletePiece(p.piece))
.collect();
Poor(insns,
"surplus marker(s) removed")
posd: None, count: Some(1), face: None, pinned: Some(false),
info: Box::new(spec),
};
- let insn = Insn::AddPieces(spec);
+ let insn = MGI::AddPieces(spec);
insns.push(insn);
}