0

minor cleanup, comments/docstring adjustment

This commit is contained in:
Andrew Brown
2011-11-01 11:18:20 -04:00
parent bcec6529d5
commit 55adc75d31
3 changed files with 27 additions and 10 deletions

View File

@@ -348,28 +348,45 @@ dir but you forgot to put quotes around the directory, since it contains spaces.
logging.error(str(e)) logging.error(str(e))
sys.exit(1) sys.exit(1)
# First do world-level preprocessing # First do world-level preprocessing. This scans the world hierarchy, reads
# in the region files and caches chunk modified times, and determines the
# chunk bounds (max and min in both dimensions)
w = world.World(worlddir, destdir, useBiomeData=useBiomeData, regionlist=regionlist, north_direction=north_direction) w = world.World(worlddir, destdir, useBiomeData=useBiomeData, regionlist=regionlist, north_direction=north_direction)
if north_direction == 'auto': if north_direction == 'auto':
north_direction = w.persistentData['north_direction'] north_direction = w.persistentData['north_direction']
options.north_direction = north_direction options.north_direction = north_direction
elif w.persistentData['north_direction'] != north_direction and not options.forcerender and not w.persistentDataIsNew: elif (w.persistentData['north_direction'] != north_direction and
not options.forcerender and
not w.persistentDataIsNew
):
logging.error("Conflicting north-direction setting!") logging.error("Conflicting north-direction setting!")
logging.error("Overviewer.dat gives previous north-direction as "+w.persistentData['north_direction']) logging.error("Overviewer.dat gives previous north-direction as "+w.persistentData['north_direction'])
logging.error("Requested north-direction was "+north_direction) logging.error("Requested north-direction was "+north_direction)
logging.error("To change north-direction of an existing render, --forcerender must be specified") logging.error("To change north-direction of an existing render, use --forcerender")
sys.exit(1) sys.exit(1)
w.go(options.procs) w.go(options.procs)
logging.info("Rending the following tilesets: %s", ",".join(options.rendermode)) logging.info("Rending the following tilesets: %s", ",".join(options.rendermode))
bgcolor = (int(options.bg_color[1:3],16), int(options.bg_color[3:5],16), int(options.bg_color[5:7],16), 0) bgcolor = (int(options.bg_color[1:3],16),
int(options.bg_color[3:5],16),
int(options.bg_color[5:7],16),
0)
# create the quadtrees # Create the quadtrees. There is one quadtree per rendermode requested, and
# TODO chunklist # therefore, per output directory hierarchy of tiles. Each quadtree
# individually computes its depth and size. The constructor computes the
# depth of the tree, while the go() method re-arranges tiles if teh current
# depth differs from the computed depth.
q = [] q = []
qtree_args = {'depth' : options.zoom, 'imgformat' : imgformat, 'imgquality' : options.imgquality, 'optimizeimg' : optimizeimg, 'bgcolor' : bgcolor, 'forcerender' : options.forcerender} qtree_args = {'depth' : options.zoom,
'imgformat' : imgformat,
'imgquality' : options.imgquality,
'optimizeimg' : optimizeimg,
'bgcolor' : bgcolor,
'forcerender' : options.forcerender,
}
for rendermode in options.rendermode: for rendermode in options.rendermode:
if rendermode == 'normal': if rendermode == 'normal':
qtree = quadtree.QuadtreeGen(w, destdir, rendermode=rendermode, tiledir='tiles', **qtree_args) qtree = quadtree.QuadtreeGen(w, destdir, rendermode=rendermode, tiledir='tiles', **qtree_args)

View File

@@ -80,7 +80,7 @@ class QuadtreeGen(object):
if depth is None: if depth is None:
# Determine quadtree depth (midpoint is always 0,0) # Determine quadtree depth (midpoint is always 0,0)
for p in xrange(64): for p in xrange(33):
# Will 2^p tiles wide and high suffice? # Will 2^p tiles wide and high suffice?
# X has twice as many chunks as tiles, then halved since this is a # X has twice as many chunks as tiles, then halved since this is a

View File

@@ -241,7 +241,7 @@ class World(object):
# col - row = chunkx + chunkx => (col - row)/2 = chunkx # col - row = chunkx + chunkx => (col - row)/2 = chunkx
return ((col - row) / 2, (col + row) / 2) return ((col - row) / 2, (col + row) / 2)
def findTrueSpawn(self): def find_true_spawn(self):
"""Adds the true spawn location to self.POI. The spawn Y coordinate """Adds the true spawn location to self.POI. The spawn Y coordinate
is almost always the default of 64. Find the first air block above is almost always the default of 64. Find the first air block above
that point for the true spawn location""" that point for the true spawn location"""
@@ -340,7 +340,7 @@ class World(object):
self.minrow = minrow self.minrow = minrow
self.maxrow = maxrow self.maxrow = maxrow
self.findTrueSpawn() self.find_true_spawn()
def _get_north_rotations(self): def _get_north_rotations(self):
if self.north_direction == 'upper-left': if self.north_direction == 'upper-left':