Save latest game state received in client to send it back to server and make the client work again with the new message protocol

This commit is contained in:
Tissevert 2019-10-19 09:31:58 +02:00
parent 7804aeecef
commit 8147589377

View file

@ -3,6 +3,7 @@ function Game(modules) {
var rest = document.getElementById("rest"); var rest = document.getElementById("rest");
var status = { var status = {
dom: document.getElementById("status"), dom: document.getElementById("status"),
game: null,
playing: false, playing: false,
step: null, step: null,
month: null month: null
@ -233,7 +234,8 @@ function Game(modules) {
function play(move) { function play(move) {
modules.messaging.send({ modules.messaging.send({
tag: "Play", tag: "Play",
move: move move: move,
onGame: status.game
}); });
} }
@ -246,6 +248,7 @@ function Game(modules) {
function setStatus(game) { function setStatus(game) {
modules.dom.clear(status.dom); modules.dom.clear(status.dom);
status.game = game;
status.step = game.public.step.tag; status.step = game.public.step.tag;
if(game.public.month != status.month) { if(game.public.month != status.month) {
status.month = game.public.month; status.month = game.public.month;