mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 02:08:21 +00:00
RegionLoader: do a full check for chunk overlaps during initial load
This commit is contained in:
@ -40,6 +40,7 @@ use function fseek;
|
||||
use function ftruncate;
|
||||
use function fwrite;
|
||||
use function is_resource;
|
||||
use function ksort;
|
||||
use function max;
|
||||
use function ord;
|
||||
use function pack;
|
||||
@ -314,6 +315,18 @@ class RegionLoader{
|
||||
}
|
||||
$usedOffsets[$offset] = $i;
|
||||
}
|
||||
ksort($usedOffsets, SORT_NUMERIC);
|
||||
$prevLocationIndex = null;
|
||||
foreach($usedOffsets as $startOffset => $locationTableIndex){
|
||||
if($prevLocationIndex !== null){
|
||||
if($this->locationTable[$locationTableIndex]->overlaps($this->locationTable[$prevLocationIndex])){
|
||||
self::getChunkCoords($locationTableIndex, $chunkXX, $chunkZZ);
|
||||
self::getChunkCoords($prevLocationIndex, $prevChunkXX, $prevChunkZZ);
|
||||
throw new CorruptedRegionException("Overlapping chunks detected in region header (chunk1: x=$chunkXX,z=$chunkZZ, chunk2: x=$prevChunkXX,z=$prevChunkZZ)");
|
||||
}
|
||||
}
|
||||
$prevLocationIndex = $locationTableIndex;
|
||||
}
|
||||
}
|
||||
|
||||
private function writeLocationTable() : void{
|
||||
|
Reference in New Issue
Block a user