Compare commits

...
2 Commits
Author SHA1 Message Date
Eric WagonerandClaude Opus 5.5 bca4d5eba7 The seat wallet's cap of fifty drops the oldest seats, not the newest
Seats are kept newest first, but the cap kept the tail, so a browser
holding more than fifty threw away the seat it had just taken. Sitting
in that room hid it (each room message remembers the seat again); the
first games poll after moving to another table lost it for good.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 18:13:09 -04:00
Eric WagonerandClaude Opus 5.5 29025f2ccb A rejoin's replayed chronicle replaces the one the table already holds
When a socket dropped and came back, the server sent the whole chronicle
again and the client appended it, so every turn was counted twice and
the instant-replay eyes asked for turns the server had not reached ("no
such turn yet"). The talk count doubled the same way and never reset
between rooms; it now resets with the chronicle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 18:01:04 -04:00
+8 -1
View File
@@ -640,6 +640,11 @@ class Net {
break;
case "events": {
let talk = 0;
// A replay is the whole chronicle from the deal, sent on every
// (re)join: it replaces what we hold, or a dropped socket's return
// would count each turn (and each line of talk) twice and the eyes
// would ask for turns the server has not reached.
if (msg.replayed) this.resetChronicle();
if (!msg.replayed) this.onFx?.(msg.events as GameEvent[]);
for (const e of msg.events as GameEvent[]) {
if (e.type === "tableTalk") { talk++; this.lastTalkBy = e.player; }
@@ -749,7 +754,8 @@ class Net {
for (const key of voided) { if (this.voidedOnce.has(key)) doubted.add(key); }
this.voidedOnce = voided;
let kept = this.seats.filter((s) => !doubted.has(`${s.roomId}:${s.name}`));
if (kept.length > 50) kept = kept.slice(kept.length - 50);
// Newest first (rememberSeat puts a seat at the front): the oldest go.
if (kept.length > 50) kept = kept.slice(0, 50);
if (kept.length !== this.seats.length) {
this.seats = kept;
saveSeats(this.seats);
@@ -1085,6 +1091,7 @@ class Net {
private resetChronicle(): void {
this.log = [];
this.turnCounter = -1;
this.chatCount = 0;
}
/** Summon one turn's reel by its chronicle turn number. */