chiark / gitweb /
Move op_do_set_z to gamestate
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 30 Apr 2022 12:21:00 +0000 (13:21 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 30 Apr 2022 14:15:30 +0000 (15:15 +0100)
This is preparatory, to reduce diff noise.  We're going to change the
way this works in a moment.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
daemon/api.rs
src/gamestate.rs

index 7ad73c400e80a7dfb835cec853ce3646883af878..22c83fa0a587861a90eaa7a7def62fedceb90ed7 100644 (file)
@@ -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);
index 5ef3a5cbc034aa0b56b504eb0b60931cbb643faf..96e848f9a423c26c023c35471dd0c22393753632 100644 (file)
@@ -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 {