1 from parser import ArgError
11 self.Thing = Thing # child classes may use an extended Thing class here
13 def set_map_size(self, yx):
15 self.map_size = (y, x)
17 for y in range(self.map_size[0]):
18 self.terrain_map += '?' * self.map_size[1]
20 def set_map_line(self, y, line):
21 width_map = self.map_size[1]
22 if y >= self.map_size[0]:
23 raise ArgError('too large row number %s' % y)
24 width_line = len(line)
25 if width_line > width_map:
26 raise ArgError('too large map line width %s' % width_line)
27 self.terrain_map = self.terrain_map[:y * width_map] + line + \
28 self.terrain_map[(y + 1) * width_map:]
30 def get_thing(self, id_):
31 for thing in self.things:
34 t = self.Thing(self, id_)
41 def __init__(self, world, id_):