0

issue #559: don't error if the map needs expanding but the tiledir was deleted

Also changed from using a join on self.destdir and self.tiledir to just
using self.full_tiledir, which is the same thing but already computed.
This commit is contained in:
Andrew Brown
2011-12-11 11:27:07 -05:00
parent d4c6e40d59
commit 4b622b1333

View File

@@ -135,7 +135,7 @@ class QuadtreeGen(object):
def _increase_depth(self):
"""Moves existing tiles into place for a larger tree"""
getpath = functools.partial(os.path.join, self.destdir, self.tiledir)
getpath = functools.partial(os.path.join, self.full_tiledir)
# At top level of the tree:
# quadrant 0 is now 0/3
@@ -162,7 +162,7 @@ class QuadtreeGen(object):
def _decrease_depth(self):
"""If the map size decreases, or perhaps the user has a depth override
in effect, re-arrange existing tiles for a smaller tree"""
getpath = functools.partial(os.path.join, self.destdir, self.tiledir)
getpath = functools.partial(os.path.join, self.full_tiledir)
# quadrant 0/3 goes to 0
# 1/2 goes to 1
@@ -204,6 +204,12 @@ class QuadtreeGen(object):
"""
# If the tile directory has been deleted somehow, then don't bother
# trying to rearrange things. It wouldn't do any good and would error
# out anyways.
if not os.path.exists(self.full_tiledir):
return
curdepth = self._get_cur_depth()
if curdepth != -1:
if self.p > curdepth: