From: Ian Jackson Date: Fri, 27 Nov 2020 20:56:13 +0000 (+0000) Subject: table_colour in game state X-Git-Tag: otter-0.2.0~334 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=13e19e08a0c0e939372008a4b87d326bdf15cd34;p=otter.git table_colour in game state Signed-off-by: Ian Jackson --- diff --git a/src/cmdlistener.rs b/src/cmdlistener.rs index 691e238f..465812c4 100644 --- a/src/cmdlistener.rs +++ b/src/cmdlistener.rs @@ -157,6 +157,7 @@ fn execute(cs: &mut CommandStream, cmd: MgmtCommand) -> MgmtResponse { let auth = authorise_by_account(cs, &ag, &game)?; let gs = crate::gamestate::GameState { + table_colour: Html::lit("green"), table_size : DEFAULT_TABLE_SIZE, pieces : Default::default(), players : Default::default(), diff --git a/src/gamestate.rs b/src/gamestate.rs index b4edba3a..dcab0298 100644 --- a/src/gamestate.rs +++ b/src/gamestate.rs @@ -41,6 +41,7 @@ pub struct ZLevel { #[derive(Debug,Serialize,Deserialize)] pub struct GameState { + pub table_colour: Colour, pub table_size : Pos, pub pieces : Pieces, pub gen : Generation, diff --git a/src/global.rs b/src/global.rs index f88ca22e..76f452bd 100644 --- a/src/global.rs +++ b/src/global.rs @@ -545,6 +545,7 @@ impl<'ig> InstanceGuard<'ig> { // New state let mut gs = GameState { // These parts are straightforward and correct + table_colour: self.c.g.gs.table_colour.clone(), table_size: self.c.g.gs.table_size, gen: self.c.g.gs.gen, max_z: self.gs.max_z.clone(), diff --git a/src/session.rs b/src/session.rs index 73e6dbec..f3abea29 100644 --- a/src/session.rs +++ b/src/session.rs @@ -6,6 +6,7 @@ use crate::imports::*; #[derive(Serialize,Debug)] struct SessionRenderContext { + table_colour: Colour, ptoken : RawToken, ctoken : RawToken, player : PlayerId, @@ -185,6 +186,7 @@ fn session(form : Json, layout: Option) }; let src = SessionRenderContext { + table_colour: ig.gs.table_colour.clone(), ctoken, gen : ig.gs.gen, log, diff --git a/templates/macros.tera b/templates/macros.tera index 4264a1d7..bff0051f 100644 --- a/templates/macros.tera +++ b/templates/macros.tera @@ -42,7 +42,7 @@ Hi {{nick | escape}} viewBox="0 0 {{ table_size[0] }} {{ table_size[1] }}" width="{{ table_size[0]*6 }}" height="{{ table_size[1]*6 }}" > - {%- for piece in uses %}