return False
return True
- def draw_presets(self, alternate_hex=0):
+ def draw_presets(self, big_yx, type_):
+ if type_ == 1:
+ if big_yx.y < 0:
+ self.terrain = 'X' * self.size_i
+ elif type_ == 2:
+ self.draw_presets_grid(big_yx)
+
+ def draw_presets_grid(self, big_yx):
old_modified = self.modified
if type(self.geometry) == MapGeometrySquare:
self.set_line(0, 'X' * self.geometry.size.x)
if self.inside(yx):
self[yx] = 'X'
+ alternate_hex = big_yx.y % 2
if alternate_hex:
draw_snake(offset + YX(0, 0))
draw_snake(offset + YX((0 + alternate_hex) * distance,
'=': Terrain('=', 'glass', blocks_sound=True, blocks_movement=True),
'T': Terrain('T', 'table', blocks_movement=True),
}
- self.draw_control_presets = True
+ self.draw_control_presets = 1
if os.path.exists(self.io.save_file):
if not os.path.isfile(self.io.save_file):
raise GameError('save file path refers to non-file')
map_geometry_shape = self.get_map_geometry_shape()
# must come before MAP, otherwise first get_map uses the default
# TODO: refactor into MAP
- write(f, 'MAP_CONTROL_PRESETS %s' % int(self.draw_control_presets))
+ write(f, 'MAP_CONTROL_PRESETS %s' % self.draw_control_presets)
write(f, 'MAP %s %s' % (map_geometry_shape, self.map_geometry.size,))
for terrain in self.terrains.values():
write(f, 'TERRAIN %s %s %s %s %s' % (quote(terrain.character),
maps = self.map_controls
if big_yx not in maps:
maps[big_yx] = SaveableMap(self.map_geometry)
- if self.draw_control_presets and type_ == 'control':
- maps[big_yx].draw_presets(big_yx.y % 2)
+ if type_ == 'control':
+ maps[big_yx].draw_presets(big_yx, self.draw_control_presets)
return maps[big_yx]
def new_world(self, map_geometry):