def __init__(self, level_list, app):
self.level_list = level_list
self.level_obj = self.level_list.get_current_level()
- self.level_obj.validate()
self.level_obj.load_tiles()
self.tiles = {}
self.view = app.root
self.remove_widget(self.nemesis_tile)
self.nemesis.reset_pos()
if self.level_obj:
- self.level_obj.validate()
self.level_obj.load_tiles()
self.player.pos = self.level_obj.enter_pos
self.remove_widget(self.player_tile)
line = line.strip()
if os.path.exists(filepath(line)):
level_file = load(line)
- self.levels.append(Level(level_file))
+ level = Level(level_file)
level_file.close()
+ try:
+ level.validate()
+ except RuntimeError as err:
+ raise RuntimeError(
+ 'Invalid level %s in level_list: %s' % (line, err))
+ self.levels.append(level)
else:
raise RuntimeError('Level list includes non-existant level %s' % line)
level_list.close()