let gpc = gs.pieces.byid_mut(piece)?;
let logents = log_did_to_piece(
- ioccults,gpl,gpc,ipc,
+ ioccults,&gs.occults, gpl,gpc,ipc,
"grasped"
)?;
let pri = piece_pri(ioccults, &gs.occults, player, gpl, piece, gpc, ipc)
.ok_or(POE::PieceGone)?;
- let pcs = pri.describe(ioccults, gpc, ipc).0;
+ let pcs = pri.describe(ioccults,&gs.occults, gpc, ipc).0;
gpc.held = Some(player);
let gpc = gs.pieces.byid_mut(piece).unwrap();
let (logents, who_by) = log_did_to_piece_whoby(
- ioccults,gpl,gpc,ipc,
+ ioccults,&gs.occults,gpl,gpc,ipc,
"released"
)?;
let who_by = who_by.ok_or(POE::PieceGone)?;
let gpc = gs.pieces.byid_mut(piece).unwrap();
let gpl = gs.players.byid_mut(player).unwrap();
let logents = log_did_to_piece(
- ioccults,gpl,gpc,ipc,
+ ioccults,&gs.occults,gpl,gpc,ipc,
"rotated"
)?;
gpc.angle = PieceAngle::Compass(self.0);
let gpc = gs.pieces.byid_mut(piece).unwrap();
let gpl = gs.players.byid_mut(player).unwrap();
let logents = log_did_to_piece(
- ioccults,gpl,gpc,ipc,
+ ioccults,&gs.occults,gpl,gpc,ipc,
if gpc.pinned { "pinned" } else { "unpinned" },
)?;
gpc.forbid_involved_in_occultation()?;
("flip", wrc@ WRC::UpdateSvg) => {
let nfaces = ipc.show(y).nfaces();
let logents = log_did_to_piece(
- ioccults,gpl,gpc,ipc,
+ ioccults,&gs.occults,gpl,gpc,ipc,
"flipped"
)?;
gpc.face = ((RawFaceId::from(gpc.face) + 1) % nfaces).into();
VisiblePieceId(piece.data())
);
let bbox = ipc.show(y).bbox_approx()?;
- let desc_html = pri.describe(ioccults, gpc, ipc);
+ let desc_html = pri.describe(ioccults,&ig.gs.occults, gpc, ipc);
Some(MgmtGamePieceVisibleInfo {
pos, face, desc_html, bbox
})
let gpc = gs.pieces.as_mut(modperm).remove(piece);
let desc_html = if let Some(gpc) = &gpc {
let pri = PieceRenderInstructions::new_visible(default());
- pri.describe(ioccults, gpc, &ipc)
+ pri.describe(ioccults,&gs.occults, gpc, &ipc)
} else {
Html::lit("<piece partially missing from game state!>")
};
let defs = pri.make_defs(ioccults, &ig.gs, gpc, ipc)?;
alldefs.push((pri.vpid, defs));
- let desc = pri.describe(ioccults, &gpc, ipc);
+ let desc = pri.describe(ioccults,&ig.gs.occults, &gpc, ipc);
let vangle = pri.angle(gpc).to_compass();
let (pos, zlevel) = pri.pos_zlevel(gpc);
println!(r#"<th align="left"><kbd>{}</kbd></th>"#,
Html::from_txt(&spec.item).0);
println!(r#"<th align="left">{}</th>"#,
- p.describe_html(&GPiece::dummy())?.0);
+ p.describe_html(&GPiece::dummy(), &default())?.0);
let only1 = s.face_cols() == 1;
for facecol in 0..(if only1 { 1 } else { max_facecols }) {
}
#[throws(IE)]
- fn describe_html(&self, _gpc: &GPiece) -> Html {
+ fn describe_html(&self, _gpc: &GPiece, _goccults: &GameOccults) -> Html {
Html::lit("the chess clock")
}
held, &self.spec, ig)
.map_err(|e| APOE::ReportViaResponse(e.into()))?;
- let log = log_did_to_piece(ioccults, gpl, gpc, ipc, &did)
+ let log = log_did_to_piece(ioccults,&gs.occults, gpl, gpc, ipc, &did)
.unwrap_or_else(|e| {
error!("failed to log: {:?}", &e);
vec![LogEntry { html: Html::lit("<failed to log>") }]
}
#[throws(IE)]
- fn describe_html(&self, gpc: &GPiece) -> Html {
+ fn describe_html(&self, gpc: &GPiece, _goccults: &GameOccults) -> Html {
Html::lit(
if self.enabled(gpc) { ENABLED_DESC } else { DISABLED_DESC }
)
fn svg_piece(&self, f: &mut Html, gpc: &GPiece, gs: &GameState,
id: VisiblePieceId) -> Result<(),IE>;
- fn describe_html(&self, gpc: &GPiece) -> Result<Html,IE>;
+ fn describe_html(&self, gpc: &GPiece, _goccults: &GameOccults)
+ -> Result<Html,IE>;
#[throws(IE)]
/// Piece is responsible for dealing with the possibility that they
}
#[throws(IE)]
- fn describe_html(&self, gpc: &GPiece) -> Html {
+ fn describe_html(&self, gpc: &GPiece, _goccults: &GameOccults) -> Html {
let xdata = gpc.xdata.get()?;
self.describe_html_inner(xdata)
}
let ounocc = ogpc.fully_visible_to_everyone()
.ok_or_else(||internal_error_bydebug(&(occulteds, &ogpc)))?;
then {
- Some(oipc.show(ounocc).describe_html(ogpc)?)
+ Some(oipc.show(ounocc).describe_html(ogpc, goccults)?)
} else {
None
}
Some(prioc@ PriOG::Visible(_)) |
Some(prioc@ PriOG::Occulted) |
Some(prioc@ PriOG::Displaced(..)) => {
- let show = prioc.describe(ioccults, gpc, ipc);
+ let show = prioc.describe(ioccults, goccults, gpc, ipc);
call_log_callback(&show)?
},
None => {
}
}
- pub fn describe(&self, ioccults: &IOccults,
+ pub fn describe(&self, ioccults: &IOccults, goccults: &GameOccults,
gpc: &GPiece, ipc: &IPiece) -> Html
{
- self.describe_fallible(ioccults, gpc, ipc)
+ self.describe_fallible(ioccults, goccults, gpc, ipc)
.unwrap_or_else(|e| {
error!("error describing piece: {:?}", e);
Html::lit("<internal error describing piece>")
#[throws(IE)]
pub fn describe_fallible(&self, ioccults: &IOccults,
+ goccults: &GameOccults,
gpc: &GPiece, ipc: &IPiece) -> Html {
match self.instead(ioccults, ipc)? {
- Left(y) => ipc.show(y).describe_html(gpc)?,
+ Left(y) => ipc.show(y).describe_html(gpc, goccults)?,
Right(i) => i.describe_html()?,
}
}
self.svg_piece_raw(f, gpc.face, &mut |_|Ok(()))?;
}
#[throws(IE)]
- fn describe_html(&self, gpc: &GPiece) -> Html {
+ fn describe_html(&self, gpc: &GPiece, _goccults: &GameOccults) -> Html {
Html(if_chain! {
if let face = gpc.face;
if let Some(colour) = self.colours.get(face);
self.svg_face(f, gpc.face, vpid)?;
}
#[throws(IE)]
- fn describe_html(&self, gpc: &GPiece) -> Html {
+ fn describe_html(&self, gpc: &GPiece, _goccults: &GameOccults) -> Html {
self.describe_face(gpc.face)?
}
// ---------- helpful utilities ----------
#[throws(OE)]
-pub fn log_did_to_piece_whoby(ioccults: &IOccults, by_gpl: &GPlayer,
+pub fn log_did_to_piece_whoby(ioccults: &IOccults, goccults: &GameOccults,
+ by_gpl: &GPlayer,
gpc: &GPiece, ipc: &IPiece, did: &str)
-> (Vec<LogEntry>, Option<Html>)
{
let y = gpc.fully_visible_to_everyone();
let desc = (||{
Ok::<_,IE>(match ipc.show_or_instead(ioccults, y)? {
- Left(y) => ipc.show(y).describe_html(gpc)?,
+ Left(y) => ipc.show(y).describe_html(gpc, goccults)?,
Right(instead) => instead.describe_html()?,
})
})().unwrap_or_else(|e|{
}
#[throws(OE)]
-pub fn log_did_to_piece(ioccults: &IOccults, by_gpl: &GPlayer,
+pub fn log_did_to_piece(ioccults: &IOccults, goccults: &GameOccults,
+ by_gpl: &GPlayer,
gpc: &GPiece, ipc: &IPiece, did: &str)
-> Vec<LogEntry> {
- log_did_to_piece_whoby(ioccults,by_gpl,gpc,ipc,did)?.0
+ log_did_to_piece_whoby(ioccults,goccults,by_gpl,gpc,ipc,did)?.0
}
// ---------- prepared updates, queued in memory ----------