fix clientPrediction reverting too many pixels

This commit is contained in:
HF 2022-11-12 21:50:39 +01:00
parent 616f6f7918
commit 240052d782

View File

@ -201,13 +201,14 @@ class PixelTransferController {
p += 1; p += 1;
} }
const spliceIndex = p;
while (p < clientPredictions.length) { while (p < clientPredictions.length) {
const [i, j, offset, color] = clientPredictions[p]; const [i, j, offset, color] = clientPredictions[p];
renderer.renderPixel(i, j, offset, color, false); renderer.renderPixel(i, j, offset, color, false);
p += 1; p += 1;
} }
this.clientPredictions.splice(p); this.clientPredictions.splice(spliceIndex);
} }
/* /*
@ -232,6 +233,8 @@ class PixelTransferController {
) { ) {
if (predPxl[4] === color) { if (predPxl[4] === color) {
clientPredictions.splice(p, 1); clientPredictions.splice(p, 1);
} else {
predPxl[3] = color;
} }
return; return;
} }