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:
@@ -135,7 +135,7 @@ class QuadtreeGen(object):
|
|||||||
|
|
||||||
def _increase_depth(self):
|
def _increase_depth(self):
|
||||||
"""Moves existing tiles into place for a larger tree"""
|
"""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:
|
# At top level of the tree:
|
||||||
# quadrant 0 is now 0/3
|
# quadrant 0 is now 0/3
|
||||||
@@ -162,7 +162,7 @@ class QuadtreeGen(object):
|
|||||||
def _decrease_depth(self):
|
def _decrease_depth(self):
|
||||||
"""If the map size decreases, or perhaps the user has a depth override
|
"""If the map size decreases, or perhaps the user has a depth override
|
||||||
in effect, re-arrange existing tiles for a smaller tree"""
|
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
|
# quadrant 0/3 goes to 0
|
||||||
# 1/2 goes to 1
|
# 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()
|
curdepth = self._get_cur_depth()
|
||||||
if curdepth != -1:
|
if curdepth != -1:
|
||||||
if self.p > curdepth:
|
if self.p > curdepth:
|
||||||
|
|||||||
Reference in New Issue
Block a user