- 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])))
+ for yx in self.maps:
+ for y, line in self.maps[yx].lines():
+ write(f, 'MAP_LINE %s %5s %s' % (yx, y, quote(line)))
+ for big_yx in self.annotations:
+ for little_yx in self.annotations[big_yx]:
+ write(f, 'GOD_ANNOTATE %s %s %s' %
+ (big_yx, little_yx, quote(self.annotations[big_yx][little_yx])))
+ for big_yx in self.portals:
+ for little_yx in self.portals[big_yx]:
+ write(f, 'GOD_PORTAL %s %s %s' % (big_yx, little_yx,
+ quote(self.portals[big_yx][little_yx])))
+ for yx in self.map_controls:
+ for y, line in self.map_controls[yx].lines():
+ write(f, 'MAP_CONTROL_LINE %s %5s %s' % (yx, y, quote(line)))
+ for tile_class in self.map_control_passwords:
+ write(f, 'MAP_CONTROL_PW %s %s' % (tile_class,
+ self.map_control_passwords[tile_class]))
+ for t in [t for t in self.things if not t.type_ == 'Player']:
+ write(f, 'THING %s %s %s %s' % (t.position[0],
+ t.position[1], t.type_, t.id_))
+ if hasattr(t, 'name'):
+ write(f, 'THING_NAME %s %s' % (t.id_, quote(t.name)))
+
+ def get_map(self, big_yx, type_='normal'):
+ if type_ == 'normal':
+ maps = self.maps
+ elif type_ == 'control':
+ maps = self.map_controls
+ if not big_yx in maps:
+ maps[big_yx] = Map(self.map_geometry)
+ return maps[big_yx]