ctm / mb2-doc

Mb2, poker software
https://devctm.com
7 stars 2 forks source link

Observing a table, but don't see the level in the upper left #1304

Closed ctm closed 5 months ago

ctm commented 6 months ago

Fix so observers see the current level, regardless of when they start observing.

I started observing table 5564 and didn't see the level in the upper left. It was level 5 at the time. I had been observing 5563 and it showed that it was level 5. As I started writing this issue, they both switched to showing it was level 6. So, my hypothesis is that an observer doesn't necessarily see which level it is until after the level changes. Oops.

ctm commented 5 months ago

For players, a new connection gets Table::prefs_and_replay invoked, and that's where the OnLevel is replayed. We don't do that for observers though for two reasons: anonymous observers don't have prefs and Structure is a big message that's not needed for observers.

TBH, I'm not yet sure if prefs are sent for signed in observers. They should be, because, for example, the four-color deck preference is relevant and known. So the solution may be to hoist the code that eventually gets prefs_and_replay sent, but to pass in an Option<PlayerId> and perhaps also something that would say whether to send the Structure message.

ctm commented 5 months ago

The culprit is that ToNickMapper::tsid_replay doesn't send the OnLevel message that ToNickMapper::replay does. That was just an oversight. I added it and am deploying now.