Skip to content

Commit

Permalink
Don't try to render tiles with nonsensical coordinates.
Browse files Browse the repository at this point in the history
I'm not sure where these came from, but I had some invalid tiles kill the
renderers.  Now those tiles will be ignored.
  • Loading branch information
asciipip committed Feb 25, 2016
1 parent 0bb8fa6 commit 81baf26
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions queuemaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,9 @@ def send_render_requests(self):
renderer.send_request()

def handle_render_request(self, t, props):
if not t.is_valid:
log_message('ignoring request for invalid tile: %s' % t)
return
if t.exists(REFERENCE_TILESET):
importance = 'important'
else:
Expand Down
9 changes: 9 additions & 0 deletions toposm.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,15 @@ def is_old(self):
else:
return tileIsOld(self.z, self.x, self.y)

@property
def is_valid(self):
if self.is_metatile:
return 0 <= self.x and self.x < 2**self.z / NTILES[self.z] and \
0 <= self.y and self.y < 2**self.z / NTILES[self.z]
else:
return 0 <= self.x and self.x < 2**self.z and \
0 <= self.y and self.y < 2**self.z


def getCachedMetaTileDir(mapname, z, x):
return path.join(TEMPDIR, mapname, str(z), str(x))
Expand Down

0 comments on commit 81baf26

Please sign in to comment.