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>
This commit is contained in:
1 parent
0ced49ca6c
commit
29025f2ccb
1 file changed
+6
@@ -640,6 +640,11 @@ class Net {
|
|||||||
break;
|
break;
|
||||||
case "events": {
|
case "events": {
|
||||||
let talk = 0;
|
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[]);
|
if (!msg.replayed) this.onFx?.(msg.events as GameEvent[]);
|
||||||
for (const e of msg.events as GameEvent[]) {
|
for (const e of msg.events as GameEvent[]) {
|
||||||
if (e.type === "tableTalk") { talk++; this.lastTalkBy = e.player; }
|
if (e.type === "tableTalk") { talk++; this.lastTalkBy = e.player; }
|
||||||
@@ -1085,6 +1090,7 @@ class Net {
|
|||||||
private resetChronicle(): void {
|
private resetChronicle(): void {
|
||||||
this.log = [];
|
this.log = [];
|
||||||
this.turnCounter = -1;
|
this.turnCounter = -1;
|
||||||
|
this.chatCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Summon one turn's reel by its chronicle turn number. */
|
/** Summon one turn's reel by its chronicle turn number. */
|
||||||
|
|||||||
Reference in new issue
Block a user