mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-06 20:07:09 +00:00
RegionGarbageMap: add an extra overlap check
this shouldn't ever be triggered, but we want to know if it does.
This commit is contained in:
parent
c2d0605b1e
commit
d084b7a34b
@ -69,11 +69,14 @@ final class RegionGarbageMap{
|
|||||||
/** @var RegionLocationTableEntry|null $prevEntry */
|
/** @var RegionLocationTableEntry|null $prevEntry */
|
||||||
$prevEntry = null;
|
$prevEntry = null;
|
||||||
foreach($usedMap as $firstSector => $entry){
|
foreach($usedMap as $firstSector => $entry){
|
||||||
$expectedStart = ($prevEntry !== null ? $prevEntry->getLastSector() + 1 : RegionLoader::FIRST_SECTOR);
|
$prevEndPlusOne = ($prevEntry !== null ? $prevEntry->getLastSector() + 1 : RegionLoader::FIRST_SECTOR);
|
||||||
$actualStart = $entry->getFirstSector();
|
$currentStart = $entry->getFirstSector();
|
||||||
if($expectedStart < $actualStart){
|
if($prevEndPlusOne < $currentStart){
|
||||||
//found a gap in the table
|
//found a gap in the table
|
||||||
$garbageMap[$expectedStart] = new RegionLocationTableEntry($expectedStart, $actualStart - $expectedStart, 0);
|
$garbageMap[$prevEndPlusOne] = new RegionLocationTableEntry($prevEndPlusOne, $currentStart - $prevEndPlusOne, 0);
|
||||||
|
}elseif($prevEndPlusOne > $currentStart){
|
||||||
|
//current entry starts inside the previous. This would be a bug since RegionLoader should prevent this
|
||||||
|
throw new AssumptionFailedError("Overlapping entries detected");
|
||||||
}
|
}
|
||||||
$prevEntry = $entry;
|
$prevEntry = $entry;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user