diff --git a/chunk.py b/chunk.py index a59d90e..977fdfa 100644 --- a/chunk.py +++ b/chunk.py @@ -129,38 +129,6 @@ fluid_blocks = set([8,9,10,11]) # (glass, half blocks) nospawn_blocks = set([20,44]) -# chunkcoords should be the coordinates of a possible chunk. it may not exist -def render_to_image(chunkcoords, img, imgcoords, quadtreeobj, cave=False, queue=None): - """Used to render a chunk to a tile in quadtree.py. - - chunkcoords is a tuple: (chunkX, chunkY) - - imgcoords is as well: (imgX, imgY), which represents the "origin" - to use for drawing. - - If the chunk doesn't exist, return False. - Else, returns True.""" - a = ChunkRenderer(chunkcoords, quadtreeobj.world, quadtreeobj.rendermode, queue) - try: - a.chunk_render(img, imgcoords[0], imgcoords[1], cave) - return True - except ChunkCorrupt: - # This should be non-fatal, but should print a warning - pass - except Exception, e: - import traceback - traceback.print_exc() - raise - except KeyboardInterrupt: - print - print "You pressed Ctrl-C. Exiting..." - # Raise an exception that is an instance of Exception. Unlike - # KeyboardInterrupt, this will re-raise in the parent, killing the - # entire program, instead of this process dying and the parent waiting - # forever for it to finish. - raise Exception() - return False - class ChunkCorrupt(Exception): pass diff --git a/quadtree.py b/quadtree.py index ac1c26c..d4018f6 100644 --- a/quadtree.py +++ b/quadtree.py @@ -453,11 +453,13 @@ class QuadtreeGen(object): ypos = -96 + (row-rowstart)*96 # draw the chunk! - a = chunk.ChunkRenderer((chunkx, chunky), world, rendermode, poi_queue) - a.chunk_render(tileimg, xpos, ypos, None) -# chunk.render_to_image((chunkx, chunky), tileimg, (xpos, ypos), self, False, None) - - + try: + a = chunk.ChunkRenderer((chunkx, chunky), world, rendermode, poi_queue) + a.chunk_render(tileimg, xpos, ypos, None) + except chunk.ChunkCorrupt: + # an error was already printed + pass + # Save them tileimg.save(imgpath)