mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-11 09:12:40 +00:00
More recruit-list checking.
This commit is contained in:
parent
b470e4d433
commit
2a46a3b031
@ -485,6 +485,9 @@ def sanity_check(filename, lines):
|
|||||||
ifdef_stack.append("!" + lines[i].strip().split()[1])
|
ifdef_stack.append("!" + lines[i].strip().split()[1])
|
||||||
continue
|
continue
|
||||||
if lines[i].startswith("#else"):
|
if lines[i].startswith("#else"):
|
||||||
|
if ifdef_stack[-1].startswith("!"):
|
||||||
|
ifdef_stack.append(ifdef_stack[-1][1:])
|
||||||
|
else:
|
||||||
ifdef_stack.append("!" + ifdef_stack[-1])
|
ifdef_stack.append("!" + ifdef_stack[-1])
|
||||||
continue
|
continue
|
||||||
if lines[i].startswith("#endif"):
|
if lines[i].startswith("#endif"):
|
||||||
@ -702,11 +705,11 @@ def sanity_check(filename, lines):
|
|||||||
|
|
||||||
def consistency_check():
|
def consistency_check():
|
||||||
"Consistency-check state information picked up by sanity_check"
|
"Consistency-check state information picked up by sanity_check"
|
||||||
utypes = []
|
#utypes = {}
|
||||||
derivedlist = map(lambda x: x[2], derived_units)
|
derivedlist = map(lambda x: x[2], derived_units)
|
||||||
baselist = map(lambda x: x[3], derived_units)
|
baselist = map(lambda x: x[3], derived_units)
|
||||||
for (filename, recruitdict, patterndict) in sides:
|
for (filename, recruitdict, patterndict) in sides:
|
||||||
for (difficulty, (rl, recruit)) in recruitdict.items():
|
for (rdifficulty, (rl, recruit)) in recruitdict.items():
|
||||||
for rtype in recruit:
|
for rtype in recruit:
|
||||||
if rtype not in unit_types:
|
if rtype not in unit_types:
|
||||||
# Assume WML coder knew what he was doing if macro reference
|
# Assume WML coder knew what he was doing if macro reference
|
||||||
@ -718,12 +721,18 @@ def consistency_check():
|
|||||||
print '"%s", line %d: %s has no usage type' % (filename, rl, rtype)
|
print '"%s", line %d: %s has no usage type' % (filename, rl, rtype)
|
||||||
continue
|
continue
|
||||||
utype = usage[rtype]
|
utype = usage[rtype]
|
||||||
#if patternlist:
|
for (pdifficulty, (pl, recruit_pattern)) in patterndict.items():
|
||||||
# (pl, recruitment_pattern) = patternlist
|
if pdifficulty is None or rdifficulty is None or pdifficulty == rdifficulty or ((rdifficulty[0]=="!") == ((pdifficulty[0]=="!"))):
|
||||||
# if utype not in recruitment_pattern:
|
#utypes[rdifficulty].append(utype)
|
||||||
# print '"%s", line %d: %s (%s) doesn\'t match the recruitment pattern (%s) for its side' % (filename, rl, rtype, utype, ", ".join(recruitment_pattern))
|
if utype not in recruit_pattern:
|
||||||
# utypes.append(utype)
|
rshow = ''
|
||||||
#for (difficulty, (pl, recruitment_pattern)) in patterndict.items():
|
if rdifficulty is not None:
|
||||||
|
rshow = 'At ' + rdifficulty + ', '
|
||||||
|
pshow = ''
|
||||||
|
if pdifficulty is not None:
|
||||||
|
pshow = ' ' + pdifficulty
|
||||||
|
print '"%s", line %d: %s%s (%s) doesn\'t match the%s recruitment pattern (%s) for its side' % (filename, rl, rshow, rtype, utype, pshow, ", ".join(recruit_pattern))
|
||||||
|
#for (pdifficulty, (pl, recruitment_pattern)) in patterndict.items():
|
||||||
# for utype in recruitment_pattern:
|
# for utype in recruitment_pattern:
|
||||||
# if utype not in utypes:
|
# if utype not in utypes:
|
||||||
# print '"%s", line %d: %s doesn\'t match a recruitable type for its side' % (filename, pl, utype)
|
# print '"%s", line %d: %s doesn\'t match a recruitable type for its side' % (filename, pl, utype)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user