From: Carl Worth Date: Sun, 17 May 2020 19:28:35 +0000 (-0700) Subject: empires: Return immediately from reveal_next if we aren't in the REVEAL state X-Git-Url: https://git.cworth.org/git?p=empires-server;a=commitdiff_plain;h=38e0c09faeefc252754b48ea9d7b2b3c93a69fe5 empires: Return immediately from reveal_next if we aren't in the REVEAL state I think this fix came about after Kevin did some testing by mashing on all of the host buttons as fast as possible. It's definitely a correct fix as far as it's true we shouldn't be revealing anything if we're not in the REVEAL state. But I think we're due for a better audit of what's happening to various pieces of state on state transitions, (such as, shouldn't the interval timer get cleared before we _leave_ the REVEAL state). --- diff --git a/empires.js b/empires.js index b0fc79e..2794c47 100644 --- a/empires.js +++ b/empires.js @@ -79,6 +79,12 @@ class Game { } reveal_next() { + /* Don't try to reveal anything if we aren't in the reveal state. */ + if (this.state != GameState.REVEAL) { + clearInterval(this.reveal_interval); + return; + } + if (this.reveal_index >= this.characters_to_reveal.length) { clearInterval(this.reveal_interval); this.broadcast_event("character-reveal", '{"character":""}');