Initial work on generating markers.js from signposts
Details: * A queue object is passed to all renderers, allowing each process to avoid using shared memory when recording signpost data. * New overviewer.dat file that stores persistent data between runs. Currently used to store information on signs. markers.js is generated by merging the stored POI list with the newly generated POI list. * POIs are tagged with their type (e.g. "spawn" or "sign"). This should be useful if different types of POIs needs to be handled/displayed differently Known bugs: * If you delete the last sign in a chunk, it won't be removed from markers.js
This commit is contained in:
22
quadtree.py
22
quadtree.py
@@ -25,6 +25,7 @@ import collections
|
||||
import json
|
||||
import logging
|
||||
import util
|
||||
import cPickle
|
||||
|
||||
from PIL import Image
|
||||
|
||||
@@ -143,12 +144,33 @@ class QuadtreeGen(object):
|
||||
if not os.path.exists(tileDir): os.mkdir(tileDir)
|
||||
blank.save(os.path.join(tileDir, "blank."+self.imgformat))
|
||||
|
||||
|
||||
if skipjs:
|
||||
return
|
||||
|
||||
# since we will only discover PointsOfInterest in chunks that need to be
|
||||
# [re]rendered, POIs like signs in unchanged chunks will not be listed
|
||||
# in self.world.POI. To make sure we don't remove these from markers.js
|
||||
# we need to merge self.world.POI with the persistant data in world.PersistentData
|
||||
|
||||
#
|
||||
modifiedChunks = map(lambda x: x['chunk'], filter(lambda x: x['type'] != 'spawn', self.world.POI))
|
||||
|
||||
for item in self.world.persistentData['POI']:
|
||||
# if this previously discovered POI isn't in a modified chunk, keep it
|
||||
if item['chunk'] not in modifiedChunks and item['type'] != 'spawn':
|
||||
self.world.POI.append(item)
|
||||
# else discard it, because self.world.POI will contain it (or not if it
|
||||
# was deleted)
|
||||
|
||||
# write out the default marker table
|
||||
with open(os.path.join(self.destdir, "markers.js"), 'w') as output:
|
||||
output.write("var markerData=%s" % json.dumps(self.world.POI))
|
||||
|
||||
# save persistent data
|
||||
self.world.persistentData['POI'] = self.world.POI
|
||||
with open(self.world.pickleFile,"wb") as f:
|
||||
cPickle.dump(self.world.persistentData,f)
|
||||
|
||||
# write out the default (empty, but documented) region table
|
||||
with open(os.path.join(self.destdir, "regions.js"), 'w') as output:
|
||||
|
||||
Reference in New Issue
Block a user