- def write(f, msg):
- f.write(msg + '\n')
-
- with open(self.io.save_file, 'w') as f:
- 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 big_yx in [yx for yx in self.maps if self.maps[yx].modified]:
- for y, line in self.maps[big_yx].lines():
- write(f, 'MAP_LINE %s %5s %s' % (big_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 big_yx in [yx for yx in self.map_controls
- if self.map_controls[yx].modified]:
- for y, line in self.map_controls[big_yx].lines():
- write(f, 'MAP_CONTROL_LINE %s %5s %s' % (big_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 pw in self.admin_passwords:
- write(f, 'ADMIN_PASSWORD %s' % pw)
- 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)))
- write(f, 'SPAWN_POINT %s %s' % (self.spawn_point[0],
- self.spawn_point[1]))
+ def write(f, msg):
+ f.write(msg + '\n')
+
+ with open(self.io.save_file, 'w') as f:
+ 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 big_yx in [yx for yx in self.maps if self.maps[yx].modified]:
+ for y, line in self.maps[big_yx].lines():
+ write(f, 'MAP_LINE %s %5s %s' % (big_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 big_yx in [yx for yx in self.map_controls
+ if self.map_controls[yx].modified]:
+ for y, line in self.map_controls[big_yx].lines():
+ write(f, 'MAP_CONTROL_LINE %s %5s %s' % (big_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 pw in self.admin_passwords:
+ write(f, 'ADMIN_PASSWORD %s' % pw)
+ 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)))
+ write(f, 'SPAWN_POINT %s %s' % (self.spawn_point[0],
+ self.spawn_point[1]))