+
+ def save(self):
+
+ def write(f, msg):
+ f.write(msg + '\n')
+
+ with open(self.io.save_file, 'w') as f:
+ # TODO: save tasks
+ write(f, 'TURN %s' % self.turn)
+ map_geometry_shape = self.get_map_geometry_shape()
+ write(f, 'MAP %s %s' % (map_geometry_shape, self.map_geometry.size,))
+ for y, line in self.map.lines():
+ write(f, 'MAP_LINE %5s %s' % (y, quote(line)))
+ for yx in self.annotations:
+ write(f, 'ANNOTATE %s %s' % (yx, quote(self.annotations[yx])))
+ for yx in self.portals:
+ write(f, 'PORTAL %s %s' % (yx, quote(self.portals[yx])))
+
+ def new_world(self, map_geometry):
+ self.map_geometry = map_geometry
+ self.map = Map(self.map_geometry.size)
+ self.annotations = {}