0

changed markers.js to output one marker per line

this has been requested *many* times, because it makes it easier to
(1) learn what format markers.js uses, and
(2) write shell scripts that process markers.js.

It shouldn't break existing processors that use json loaders, and does
not drastically increase file size (just one extra byte per ~70).
This commit is contained in:
Aaron Griffith
2011-04-10 04:38:42 -04:00
parent 22fc77308e
commit a2b1f238d9

View File

@@ -144,7 +144,13 @@ class MapGen(object):
# write out the default marker table # write out the default marker table
with open(os.path.join(self.destdir, "markers.js"), 'w') as output: with open(os.path.join(self.destdir, "markers.js"), 'w') as output:
output.write("var markerData=%s" % json.dumps(self.world.POI)) output.write("var markerData=[\n")
for marker in self.world.POI:
output.write(json.dumps(marker))
if marker != self.world.POI[-1]:
output.write(",")
output.write("\n")
output.write("]\n")
# save persistent data # save persistent data
self.world.persistentData['POI'] = self.world.POI self.world.persistentData['POI'] = self.world.POI