]> git.cworth.org Git - empires-server/commit
Fix JSON stringification of game-state at game reset
authorCarl Worth <cworth@cworth.org>
Sat, 27 Jun 2020 21:55:46 +0000 (14:55 -0700)
committerCarl Worth <cworth@cworth.org>
Sat, 27 Jun 2020 21:55:46 +0000 (14:55 -0700)
commit239210c6be9b15e3ee31cc28d4e7e5f83ababd89
treee105b8341c13a81dc75334f8ead19655902d608d
parent3740e6f5ca87eac244bc2969b19a37939e9efc28
Fix JSON stringification of game-state at game reset

The initial stream of game state upon player connection was already
careful to use a subsitute function for correct stringification of
Set objects, but the streaming at game reset was not.

I didn't notice this for a while because the client always reset its
own state data before applying what was streamed from the server. The
application of the server-provided state would fail, (encountering an
empty object instead of an empty array), but since the client state
was already reset anyway, that wasn't noticed, (as long as the failure
only happened after the prompt data, for example).

I uncovered the bug with a recent client fix to not display the
category-input form until the game-state was received, (and the
Boolean to trigger that display happened only after the portions of
the game state that were failing due to the bug described above).
empathy.js
game.js