Remove duplicated tiles from chunk table automatically

This commit is contained in:
Shoghi Cervantes
2014-11-20 21:45:52 +01:00
parent 754e0dbb49
commit 8eb80be691
2 changed files with 6 additions and 8 deletions

View File

@ -237,7 +237,10 @@ abstract class BaseFullChunk implements FullChunk{
public function addTile(Tile $tile){
$this->tiles[$tile->getID()] = $tile;
$this->tileList[(($tile->z & 0x0f) << 12) | (($tile->x & 0x0f) << 8) | ($tile->y & 0xff)] = $tile;
if(isset($this->tileList[$index = (($tile->z & 0x0f) << 12) | (($tile->x & 0x0f) << 8) | ($tile->y & 0xff)]) and $this->tileList[$index] !== $tile){
$this->tileList[$index]->close();
}
$this->tileList[$index] = $tile;
$this->hasChanged = true;
}