As requested, a PR based on dev branch and for dev branch. PR for master branch is/was #18.
Warning: due to bugs in the rendering of newly placed tiles, it's hard for me to test this PR. For what I can see, the changes are working: player can reconnect, tile updates are processed but just not visually shown. The player can still move hero's on that tile, so the client knows the new tile is there. It's just the rendering. But this was already a bug on the dev branch, I see.
In addition to the previous PR, this PR is focused on fixing reconnecting problems. In short, after a player reconnects (may be due to internet delays (this was my main aim, but couldn't test it so far) or refreshing the web page), he/she can continue playing the game.
Also, I squeezed another game rule in this PR: pausing the game when the clock inverts: 2aae7e4.
Features:
disconnected player will only be kicked from the room when disconnecting in the lobby (=> the room but game hasn't started)
disconnected player will remain a player during the game
disconnected players and spectators are visibly shown
reconnected player keeps his previous roles if using the same username
pause game when clock inverts
Fixes:
received status update processes board state correctly
prevent duplicate tile id's in tiles.stock[] and tiles.board[]
prevent errors for non-initialized tiles
tiles.stock[] updates correctly for every player
player can interact with the board after reconnect without the need to move mouse out of the screen
As requested, a PR based on dev branch and for dev branch. PR for master branch is/was #18.
Warning: due to bugs in the rendering of newly placed tiles, it's hard for me to test this PR. For what I can see, the changes are working: player can reconnect, tile updates are processed but just not visually shown. The player can still move hero's on that tile, so the client knows the new tile is there. It's just the rendering. But this was already a bug on the dev branch, I see.
In addition to the previous PR, this PR is focused on fixing reconnecting problems. In short, after a player reconnects (may be due to internet delays (this was my main aim, but couldn't test it so far) or refreshing the web page), he/she can continue playing the game. Also, I squeezed another game rule in this PR: pausing the game when the clock inverts: 2aae7e4.
Features:
Fixes:
Also, sorry about the auto reformatting..