note when recruitment mismatches involve non-standard usage classes
When recruitment patterns include bogus usage classes, it will trigger a message during the consistency check. However, this check won't tell you whether your problem is with the usage classes or the recruits. For example, if you get a message that "no light fighter units are recruitable", your first thought might be that you didn't include a light fighter unit in the recruit list. The message doesn't clue you in directly that the light fighter simply doesn't exist in mainline. Now a clause will be added to the message when non-mainline recruitment classes are involved, alerting designers when bogus usage classes are involved, but mild enough that it hopefully won't scare away authors legitimately seeking to use custom classes. This replaces the old usage check. The next commit will add a magic comment for appending custom usage types.
This commit is contained in:
parent
7f66f29d73
commit
990ac9a901
1 changed files with 12 additions and 2 deletions
|
@ -681,6 +681,10 @@ notepairs = [
|
|||
# but must be populated by the magic comment, "#wmllint: who ... is ...".
|
||||
whopairs = {}
|
||||
|
||||
# This list of the standard recruitable usage types can be appended with the
|
||||
# magic comment, "#wmllint: usagetype[s]".
|
||||
usage_types = ["scout", "fighter", "mixed fighter", "archer", "healer"]
|
||||
|
||||
# These are accumulated by sanity_check() and examined by consistency_check()
|
||||
unit_types = []
|
||||
derived_units = []
|
||||
|
@ -1586,10 +1590,13 @@ def consistency_check():
|
|||
rshow = ''
|
||||
if rdifficulty is not None:
|
||||
rshow = 'At ' + rdifficulty + ', '
|
||||
ushow = ''
|
||||
if utype not in usage_types:
|
||||
ushow = ', a non-standard usage class'
|
||||
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))
|
||||
print '"%s", line %d: %s%s (%s%s) doesn\'t match the%s recruitment pattern (%s) for its side' % (filename, rl, rshow, rtype, utype, ushow, pshow, ", ".join(recruit_pattern))
|
||||
# We have a list of all the usage types recruited at this difficulty
|
||||
# in utypes. Use it to check the matching pattern, if any. Suppress
|
||||
# this check if the recruit line is a macroexpansion.
|
||||
|
@ -1601,7 +1608,10 @@ def consistency_check():
|
|||
rshow = '.'
|
||||
if rdifficulty is not None:
|
||||
rshow = ' at difficulty ' + rdifficulty + '.'
|
||||
print '"%s", line %d: no %s units recruitable%s' % (filename, pl, utype, rshow)
|
||||
ushow = ''
|
||||
if utype not in usage_types:
|
||||
ushow = ' (a non-standard usage class)'
|
||||
print '"%s", line %d: no %s%s units recruitable%s' % (filename, pl, utype, ushow, rshow)
|
||||
if movetypes:
|
||||
for (unit_id, filename, line, movetype) in unit_movetypes:
|
||||
if movetype not in movetypes:
|
||||
|
|
Loading…
Add table
Reference in a new issue