mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-06 11:57:10 +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 */
|
||||
$prevEntry = null;
|
||||
foreach($usedMap as $firstSector => $entry){
|
||||
$expectedStart = ($prevEntry !== null ? $prevEntry->getLastSector() + 1 : RegionLoader::FIRST_SECTOR);
|
||||
$actualStart = $entry->getFirstSector();
|
||||
if($expectedStart < $actualStart){
|
||||
$prevEndPlusOne = ($prevEntry !== null ? $prevEntry->getLastSector() + 1 : RegionLoader::FIRST_SECTOR);
|
||||
$currentStart = $entry->getFirstSector();
|
||||
if($prevEndPlusOne < $currentStart){
|
||||
//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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user