From 421b91c0ff0d1fdbc7c4f65323ac9e99ba613f24 Mon Sep 17 00:00:00 2001 From: Tissevert Date: Thu, 16 Jan 2020 22:33:41 +0100 Subject: [PATCH] Stop emitting the (temporarily ?) deprecated Quit message at the endof a game and factorize the function to go back to main menu instead --- js/GUI/Screen/Game.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/js/GUI/Screen/Game.js b/js/GUI/Screen/Game.js index 6738935..9d28287 100644 --- a/js/GUI/Screen/Game.js +++ b/js/GUI/Screen/Game.js @@ -38,13 +38,15 @@ function init(gameID) { ); } +function backToMain() { + window.location = '..'; +} + function fail(errorCode) { return function(f) { Screen.dialog({ text: I18n.get(errorCode), - answers: [ - {label: 'backToMain', action: function() {window.location = '..';}} - ] + answers: [{label: 'backToMain', action: backToMain}] }); } } @@ -160,14 +162,7 @@ function gameEnd(o, f) { } Screen.dialog({ text: I18n.get(Session.is(winner) ? 'won' : 'lost'), - answers: [{ - label: 'endGame', - action: function() { - Messaging.send({tag: "Quit"}); - Screen.select('reception'); - f(); - } - }] + answers: [{label: 'endGame', action: backToMain}] }); }