From 5fb00671682db9d25e12dfe6880d74f94c87f5da Mon Sep 17 00:00:00 2001 From: yukirij Date: Sun, 6 Oct 2024 12:44:30 -0700 Subject: [PATCH] Send notification updates on undo; fix practice on retire; fix loading game from challenge. --- server/src/manager/data.rs | 3 +++ www/js/interface.js | 2 -- www/js/scene.js | 11 +++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/server/src/manager/data.rs b/server/src/manager/data.rs index 68a9deb..cd1f0cf 100644 --- a/server/src/manager/data.rs +++ b/server/src/manager/data.rs @@ -726,6 +726,9 @@ pub async fn thread_system(mut app:App, bus:Bus) )); } + send_user_status.push(session.p_dawn.user); + send_user_status.push(session.p_dusk.user); + session.undo = 0; } } diff --git a/www/js/interface.js b/www/js/interface.js index c36a800..3c7abf1 100644 --- a/www/js/interface.js +++ b/www/js/interface.js @@ -1439,8 +1439,6 @@ const INTERFACE = { case INTERFACE.Mode.Local: { INTERFACE.history_push(play, true); - INTERFACE.game_step(); - if(INTERFACE_DATA.Game.auto !== null && INTERFACE_DATA.Game.auto == (GAME_DATA.turn & 1)) { setTimeout(INTERFACE.auto_play, 1000); } diff --git a/www/js/scene.js b/www/js/scene.js index ae7bc1a..690201d 100644 --- a/www/js/scene.js +++ b/www/js/scene.js @@ -675,10 +675,17 @@ const SCENES = { // Practice Button if(data.mode == INTERFACE.Mode.Review) { let play_callback = function() { + let turn = INTERFACE_DATA.Replay.turn; + if(INTERFACE_DATA.Game.history.length > 0) { + if(INTERFACE_DATA.Game.history[turn - 1].source == 0xF) { + turn -= 1; + } + } + LOAD(SCENES.GamePractice, { token:this.token, history:INTERFACE_DATA.Game.history, - turn:INTERFACE_DATA.Replay.turn, + turn:turn, }); } play_callback = play_callback.bind({ @@ -1002,7 +1009,7 @@ const SCENES = { case OpCode.ChallengeAnswer: { if(data.status == Status.Ok) { LOAD(SCENES.GameLoad, { - token:this.token, + token:data.token, mode:INTERFACE.Mode.Player, }); } else {