chiark / gitweb /
angle: Actually copy angle when we get a piece update
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 28 Feb 2021 13:26:14 +0000 (13:26 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 28 Feb 2021 13:39:58 +0000 (13:39 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/gamestate.rs
src/updates.rs
templates/script.ts

index 6fef4f9c11f9df499069c11b009d8b6f091975d6..5d03737dffc0514c686d8f5b78a1e0408c30316d 100644 (file)
@@ -278,6 +278,7 @@ impl GPiece {
       svg        : pri.make_defs(self, &p)?,
       z          : self.zlevel.z.clone(),
       zg         : self.zlevel.zg,
+      angle      : pri.angle(self).to_compass(),
       pinned     : self.pinned,
       uos        : pri.ui_operations(self, p)?,
     }
index 41297a2eaca4e66ea1641f7a023fac840ed1e0af..c68ca80e6838a8320f4c8b0951ad0e3fc0e475e5 100644 (file)
@@ -83,6 +83,7 @@ pub struct PreparedPieceState {
   pub held: Option<PlayerId>,
   pub z: ZCoord,
   pub zg: Generation,
+  pub angle: CompassAngle,
   pub pinned: bool,
   pub uos: Vec<UoDescription>,
 }
index cfad75fd1234219722e6f30c83ce9ad851c52064..d54a00a5d001146ab7b403f67cc21d5136ca0d63 100644 (file)
@@ -1032,6 +1032,7 @@ type PreparedPieceState = {
   z: ZCoord,
   zg: Generation,
   pinned: boolean,
+  angle: number,
   uos: UoDescription[],
 }
 
@@ -1061,6 +1062,7 @@ function piece_modify(piece: PieceId, p: PieceInfo, info: PreparedPieceState,
   p.uelem.setAttributeNS(null, "y", info.pos[1]+"");
   p.held = info.held;
   p.pinned = info.pinned;
+  p.angle = info.angle;
   p.uos = info.uos;
   piece_set_zlevel(piece,p, (oldtop_piece)=>{
     p.z  = info.z;