games: the card the dealer never turned over, and the bet that came back doubled

Bust every hand and the dealer doesn't draw, which is right, but it was also
not turning over: reveal is only emitted by dealerPlay, and busting out skips
the dealer entirely. The browser kept the hole card face down while the settled
state printed the dealer's whole total under it. Emit the reveal on that path.

And standing your bet back up after a reload read the hand's bet straight off
the settled state, which a double has already doubled. Reload, double 200, and
the next hand starts with 400 on the spot.

Plus: the share card was hand-writing a Content-Length that ServeContent
overwrites anyway, and serving a zero-byte 200 for a room with no card.

Claude-Session: https://claude.ai/code/session_013M5nD7PgUboJXoDcYHzpuJ
This commit is contained in:
prosolis
2026-07-14 14:22:14 -07:00
parent 57c445ff29
commit a5b7e41929
5 changed files with 65 additions and 14 deletions

View File

@@ -436,7 +436,7 @@
// has to refuse.
return settleChips(final)
.then(money)
.then(function () { return standing(base || (final.hands[0] && final.hands[0].bet)); })
.then(function () { return standing(base || unitBet(final.hands[0])); })
.then(function () { setPhase(final); });
});
}
@@ -450,6 +450,16 @@
// It's one hand's worth, not the whole deal's: a split cost you four hundred,
// and standing four hundred back up on one spot would be betting a stranger's
// money on your behalf.
// unitBet is what one hand of a deal actually cost, read back off a settled
// hand. It exists for the reload: `base` only knows what you pressed Deal with,
// and if you reloaded mid-hand nobody pressed Deal. A doubled hand carries twice
// the stake it was dealt with, so standing its bet back up would quietly put you
// on double the number you thought you were playing.
function unitBet(h) {
if (!h) return 0;
return h.doubled ? h.bet / 2 : h.bet;
}
function standing(amount) {
var money = window.PeteGames.view();
if (!amount || !money || money.chips < amount) {