0

If overviewer.dat doesn't exist, don't give a north-direction warning

This commit is contained in:
Andrew Chin
2011-08-17 20:04:25 -04:00
parent 42cb4b7756
commit 01bba80c54
2 changed files with 3 additions and 1 deletions

View File

@@ -244,7 +244,7 @@ def main():
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: 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)

View File

@@ -111,6 +111,7 @@ class World(object):
self.pickleFile = os.path.join(self.outputdir, "overviewer.dat") self.pickleFile = os.path.join(self.outputdir, "overviewer.dat")
if os.path.exists(self.pickleFile): if os.path.exists(self.pickleFile):
self.persistentDataIsNew = False;
with open(self.pickleFile,"rb") as p: with open(self.pickleFile,"rb") as p:
self.persistentData = cPickle.load(p) self.persistentData = cPickle.load(p)
if not self.persistentData.get('north_direction', False): if not self.persistentData.get('north_direction', False):
@@ -119,6 +120,7 @@ class World(object):
else: else:
# some defaults, presumably a new map # some defaults, presumably a new map
self.persistentData = dict(POI=[], north_direction='lower-left') self.persistentData = dict(POI=[], north_direction='lower-left')
self.persistentDataIsNew = True # indicates that the values in persistentData are new defaults, and it's OK to override them
# handle 'auto' north # handle 'auto' north
if self.north_direction == 'auto': if self.north_direction == 'auto':