blanchon commited on
Commit
0ce2f31
·
1 Parent(s): 6b77a69

Don't let dead players cap the grid-mode buffer indicator

Browse files

Strict-intersecting all 10 tiles' buffered ranges meant a player who died
at t=30 capped the unified bar at 30 even when every other tile was
buffered to the round end. Pad each player's buffer with [dur, roundEnd]
before intersecting — there's no stream there for them to buffer, so they
should drop out as a constraint past their own death.

src/lib/components/perspective-grid.svelte CHANGED
@@ -81,7 +81,22 @@
81
  const tileBuffers = new Map<number, BufferedRange[]>();
82
 
83
  function intersectAll(): BufferedRange[] {
84
- const lists = Array.from(tileBuffers.values()).filter((ranges) => ranges.length > 0);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  if (!lists.length) return [];
86
 
87
  let acc = lists[0];
 
81
  const tileBuffers = new Map<number, BufferedRange[]>();
82
 
83
  function intersectAll(): BufferedRange[] {
84
+ const roundEnd = Math.max(0, ...Array.from(playerDurations.values()));
85
+ if (roundEnd <= 0) return [];
86
+
87
+ // For a player who died early (stream shorter than the round), pad the
88
+ // buffer list with a synthetic [dur, roundEnd] range. There is no stream
89
+ // there for them to buffer, so they shouldn't constrain the unified
90
+ // indicator past their own death.
91
+ const lists: BufferedRange[][] = [];
92
+ for (const [player, ranges] of tileBuffers) {
93
+ const dur = playerDurations.get(player);
94
+ const padded =
95
+ dur != null && Number.isFinite(dur) && dur < roundEnd
96
+ ? [...ranges, { start: dur, end: roundEnd }]
97
+ : ranges;
98
+ if (padded.length > 0) lists.push(padded);
99
+ }
100
  if (!lists.length) return [];
101
 
102
  let acc = lists[0];