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:
parent
b2d8748bcb
commit
f690d8e21f
|
|
@ -7000,7 +7000,7 @@
|
||||||
}
|
}
|
||||||
function deletePixel(x,y) {
|
function deletePixel(x,y) {
|
||||||
// remove pixelMap[x][y] from currentPixels
|
// 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;}
|
if (pixelMap[x][y]) {pixelMap[x][y].del = true;}
|
||||||
delete pixelMap[x][y];
|
delete pixelMap[x][y];
|
||||||
/*for (var i = 0; i < currentPixels.length; i++) {
|
/*for (var i = 0; i < currentPixels.length; i++) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue