Remove comments in yaml files.
Throw a meaningful error if the door-shuffle setting is invalid.
This commit is contained in:
@@ -55,6 +55,9 @@ def link_doors(world, player):
|
|||||||
cross_dungeon(world, player)
|
cross_dungeon(world, player)
|
||||||
elif world.doorShuffle[player] == 'experimental':
|
elif world.doorShuffle[player] == 'experimental':
|
||||||
experiment(world, player)
|
experiment(world, player)
|
||||||
|
else:
|
||||||
|
logging.getLogger('').error('Invalid door shuffle setting: %s' % world.doorShuffle[player])
|
||||||
|
raise Exception('Invalid door shuffle setting: %s' % world.doorShuffle[player])
|
||||||
|
|
||||||
if world.doorShuffle[player] != 'vanilla':
|
if world.doorShuffle[player] != 'vanilla':
|
||||||
create_door_spoiler(world, player)
|
create_door_spoiler(world, player)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import logging
|
|||||||
import random
|
import random
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
|
import re
|
||||||
|
|
||||||
from DungeonRandomizer import parse_arguments
|
from DungeonRandomizer import parse_arguments
|
||||||
from Main import main as DRMain
|
from Main import main as DRMain
|
||||||
@@ -14,6 +15,7 @@ def parse_yaml(txt):
|
|||||||
ret = {}
|
ret = {}
|
||||||
indents = {len(txt) - len(txt.lstrip(' ')): ret}
|
indents = {len(txt) - len(txt.lstrip(' ')): ret}
|
||||||
for line in txt.splitlines():
|
for line in txt.splitlines():
|
||||||
|
line = re.sub(r'#.*', '', line)
|
||||||
if not line:
|
if not line:
|
||||||
continue
|
continue
|
||||||
name, val = line.split(':', 1)
|
name, val = line.split(':', 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user