execute_for_game(cs, &mut ig, insns, MgmtGameUpdateMode::Bulk)
.map_err(|e|{
let name = ig.name.clone();
- Instance::destroy(ig)
+ Instance::destroy_game(ig)
.unwrap_or_else(|e|
eprintln!("failed to tidy up failecd creation of {:?}: {:?}",
&name, &e));
pub player : PlayerId,
}
-type DenseSlotMap<PlayerId,PlayerState>;
+pub type PlayerMap = DenseSlotMap<PlayerId,PlayerState>;
+/* xxx
#[derive(Serialize,Deserialize)]
#[repr(transparent)]
pub struct PlayerMap(ActualPlayerMap);
// No DerefMut: callers in this module should access .0 directly
// This prevents accidental modification of Players without appropriate
// synchrnoisation.
+*/
/// UPDATE RELIABILITY/PERSISTENCE RULES
///
.clone()
}
- #[throws(MgmtError)]
+ #[throws(ServerFailure)]
pub fn destroy_game(mut g: InstanceGuard) {
let a_savefile = InstanceGuard::savefile(&g.name, "a-", "");
- let gw = GLOBAL.games.write().unwrap();
+ let mut gw = GLOBAL.games.write().unwrap();
fs::remove_file(InstanceGuard::savefile(&g.name, "g-", ""))?;
(||{ // Infallible:
gw.remove(&g.name);
InstanceGuard::forget_all_tokens(&mut g.tokens_clients);
InstanceGuard::forget_all_tokens(&mut g.tokens_players);
- }()); // <- No ?, ensures that IEFE is infallible (barring panics)
+ })(); // <- No ?, ensures that IEFE is infallible (barring panics)
(||{ // Best effort:
fs::remove_file(&a_savefile)