From 0fd60d8edd31d377447da5859ca6c43644828bf4 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 30 Apr 2022 13:21:00 +0100 Subject: [PATCH] Move op_do_set_z to gamestate This is preparatory, to reduce diff noise. We're going to change the way this works in a moment. Signed-off-by: Ian Jackson --- daemon/api.rs | 8 -------- src/gamestate.rs | 10 ++++++++++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/daemon/api.rs b/daemon/api.rs index 7ad73c40..22c83fa0 100644 --- a/daemon/api.rs +++ b/daemon/api.rs @@ -464,14 +464,6 @@ api_route!{ } } -#[throws(ApiPieceOpError)] -fn op_do_set_z(gpc: &mut GPiece, gen: Generation, z: &ZCoord) { - if gpc.occult.is_active() { - if z >= &gpc.zlevel.z { throw!(Ia::Occultation) } - } - gpc.zlevel = ZLevel { z: z.clone(), zg: gen }; -} - api_route!{ api_move, "/_/api/m", struct ApiPieceMove(Pos); diff --git a/src/gamestate.rs b/src/gamestate.rs index 5ef3a5cb..96e848f9 100644 --- a/src/gamestate.rs +++ b/src/gamestate.rs @@ -804,6 +804,16 @@ mod test { } } +// ---------- 2-phase Z level setting ---------- + +#[throws(ApiPieceOpError)] +pub fn op_do_set_z(gpc: &mut GPiece, gen: Generation, z: &ZCoord) { + if gpc.occult.is_active() { + if z >= &gpc.zlevel.z { throw!(Ia::Occultation) } + } + gpc.zlevel = ZLevel { z: z.clone(), zg: gen }; +} + // ---------- log expiry ---------- impl GameState { -- 2.30.2