Prevent deletePixel splicing of index -1 as a cause of ghost pixels

when this happens, pixels are "deleted" starting from the newest pixel created and become ghost pixels present in pixelMap but not currentPixels (in worldgen worlds, this manifests as the pixels disappearing from the upwards and leftwards from the bottom right)
This commit is contained in:
Laetitia (O-01-67) 2022-12-13 12:14:56 -05:00 committed by GitHub
parent b2d8748bcb
commit f690d8e21f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -7000,7 +7000,7 @@
}
function deletePixel(x,y) {
// remove pixelMap[x][y] from currentPixels
currentPixels.splice(currentPixels.indexOf(pixelMap[x][y]),1);
if(currentPixels.indexOf(pixelMap[x][y]) !== -1) { currentPixels.splice(currentPixels.indexOf(pixelMap[x][y]),1) };
if (pixelMap[x][y]) {pixelMap[x][y].del = true;}
delete pixelMap[x][y];
/*for (var i = 0; i < currentPixels.length; i++) {