p.gen_before_lastclient = p.gen_lastclient;
p.lastclient = client;
}
- let json = UpdatePayload::PieceUpdate(piece, p.mk_update());
+ let vpiece = form.piece; // split view needs modified value!
+ let pri = PieceRenderInstructions {
+ id : vpiece,
+ face : p.face,
+ };
+ let json = UpdatePayload::PieceUpdate(vpiece, p.mk_update(&pri));
let json = serde_json::to_string(&json).expect("convert to json");
let update = PreparedUpdate {
gen,
client,
- piece : form.piece, // split view needs modified value!
+ piece : vpiece,
cseq : form.cseq,
json,
};
defs
}
- pub fn mk_update(&self) -> PieceUpdate {
+ pub fn mk_update(&self, pri : &PieceRenderInstructions) -> PieceUpdate {
PieceUpdate {
pos : self.pos,
held : self.held,
+ svgs : self.make_defs(pri),
// xxx want all piece's stuff in the same def
}
}
pub struct PieceUpdate {
pub pos : Pos,
pub held : Option<PlayerId>,
-// pub svgs : Vec<String,String>;
+ pub svgs : String,
}
#[derive(Debug,Serialize)]
pub enum UpdatePayload {
NoUpdate,
ClientSequence(PieceId, ClientSequence),
- PieceDelete(PieceId),
- PieceInsert(PieceId, PieceUpdate),
- PieceUpdate(PieceId, PieceUpdate),
- PieceMove(PieceId, Pos),
+ PieceDelete(VisiblePieceId),
+ PieceInsert(VisiblePieceId, PieceUpdate),
+ PieceUpdate(VisiblePieceId, PieceUpdate),
+ PieceMove(VisiblePieceId, Pos),
}