From 137de7c954abab26c27d904651cebd0fe5cfb14d Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 25 Mar 2021 11:01:18 +0000 Subject: [PATCH] occregion: Send to client (but this is wrong, it should be json string) Signed-off-by: Ian Jackson --- daemon/session.rs | 2 ++ src/hidden.rs | 8 ++++++++ src/pcrender.rs | 1 + src/updates.rs | 1 + 4 files changed, 12 insertions(+) diff --git a/daemon/session.rs b/daemon/session.rs index ce68500e..0164b789 100644 --- a/daemon/session.rs +++ b/daemon/session.rs @@ -49,6 +49,7 @@ struct SessionPieceLoadJson<'r> { desc: Html, uos: &'r [UoDescription], moveable: PieceMoveable, + occregion: Option<&'r Region>, } #[derive(Serialize,Debug)] @@ -141,6 +142,7 @@ fn session_inner(form: Json, desc, moveable: gpc.moveable(), uos: &pri.ui_operations(&ig.gs, gpc, ipc)?, + occregion: gpc.occult.active_region(&ig.gs.occults)?, }; let for_piece = SessionPieceContext { diff --git a/src/hidden.rs b/src/hidden.rs index 5c41bbf6..cfa37763 100644 --- a/src/hidden.rs +++ b/src/hidden.rs @@ -106,6 +106,14 @@ impl PieceOccult { ) } + #[throws(IE)] + pub fn active_region<'r>(&'r self, goccults: &'r GameOccults) + -> Option<&'r Region> { + self.active_occ(goccults)?.map( + |occ| &occ.region + ) + } + #[throws(IE)] pub fn active_total_ppieces(&self, goccults: &GameOccults) -> Option { diff --git a/src/pcrender.rs b/src/pcrender.rs index 2e5b016e..232c39b5 100644 --- a/src/pcrender.rs +++ b/src/pcrender.rs @@ -126,6 +126,7 @@ impl PieceRenderInstructions { pinned : gpc.pinned, uos : pri.ui_operations(gs, gpc, ipc)?, moveable : gpc.moveable(), + occregion : gpc.occult.active_region(&gs.occults)?.cloned(), }; dbgc!(pri, ipc, gpc, r); r diff --git a/src/updates.rs b/src/updates.rs index d9e8551e..ddeea607 100644 --- a/src/updates.rs +++ b/src/updates.rs @@ -107,6 +107,7 @@ pub struct PreparedPieceState { pub pinned: bool, pub moveable: PieceMoveable, pub uos: Vec, + pub occregion: Option>, } #[derive(Debug,Copy,Clone,Serialize,Deserialize,Eq)] -- 2.30.2