wmllint: removed a few asserts and postponed a few unit sanity checks

Fixes #4102
This commit is contained in:
Elvish_Hunter 2019-11-10 10:45:46 +01:00
parent 5162168a67
commit 8f52a49800
2 changed files with 21 additions and 0 deletions

View file

@ -40,6 +40,7 @@
* Removed map scaling algorithm customization. Nearest-neighbor scaling will now
always be used.
* Make wmllint ignore race= keys if they are part of filters inside [unit_type] (issue #4105)
* Removed a few assserts from wmllint and postponed a few unit sanity checks to the closing of a [unit_type] tag (issue #4102)
## Version 1.15.2
### AI:

View file

@ -1469,10 +1469,26 @@ def global_sanity_check(filename, lines):
has_special_notes = False
in_unit_type = nav.lineno + 1
hitpoints_specified = False
unit_usage = ""
temp_movetypes = []
temp_races = []
temp_advances = []
continue
elif nav.element == "[/unit_type]":
#print('"%s", %d: unit has traits %s and notes %s' \
# % (filename, in_unit_type, traits, notes))
if unit_id and unit_usage:
usage[unit_id] = unit_usage
if unit_id and temp_movetypes:
for movetype in temp_movetypes:
# movetype, race and advance are 3-element tuples, expand them
unit_movetypes.append((unit_id, *movetype))
if unit_id and temp_races:
for race in temp_races:
unit_races.append((unit_id, *race))
if unit_id and temp_advances:
for advance in temp_advances:
advances.append((unit_id, *advance))
if unit_id and base_unit:
derived_units.append((filename, nav.lineno + 1, unit_id, base_unit))
if unit_id and not base_unit:
@ -1510,6 +1526,10 @@ def global_sanity_check(filename, lines):
base_unit = ""
has_special_notes = False
unit_race = None
unit_usage = ""
temp_movetypes = []
temp_races = []
temp_advances = []
elif nav.element == "[special_note]":
has_special_notes = True
# the glob pattern matches any WML tag starting with filter, including [filter] itself