check for already present chunk using containsChunk

This commit is contained in:
David Vierra 2010-12-03 18:06:41 -10:00
parent 5f6cf2aa14
commit 8b3fa2f163

View File

@ -3000,8 +3000,9 @@ class MCInfdevOldLevel(MCLevel):
self._bounds = None self._bounds = None
def createChunk(self, cx, cz): def createChunk(self, cx, cz):
if (cx,cz) in self._loadedChunks: raise ValueError, "{0}:Chunk {1} already present!".format(self, (cx,cz) ) if self.containsChunk(cx,cz): raise ValueError, "{0}:Chunk {1} already present!".format(self, (cx,cz) )
if self._allChunks is not None: self._allChunks.add( (cx,cz) ) if self._allChunks is not None:
self._allChunks.add( (cx,cz) )
self._loadedChunks[cx,cz] = InfdevChunk(self, (cx,cz), create = True) self._loadedChunks[cx,cz] = InfdevChunk(self, (cx,cz), create = True)
self._bounds = None self._bounds = None