clean up get_hit_sound messages

The first message has a couple of problems. Technically, get_hit_sound is not a tag, and there is a stray quote mark at the end. Also, i+1 points to the line number of the [/unit] tag, which is not particularly helpful information. This can be changed to point to the line of the get_hit_sound attribute.

For the second message, the %d get_hit_sound is an index position, so +1 for the line number.
This commit is contained in:
Groggy Dice 2013-07-01 19:47:45 -04:00
parent f5d3846748
commit 8674bd3f8a

View file

@ -1017,12 +1017,12 @@ def hack_syntax(filename, lines):
elif "[/unit]" in lines[i]:
if unit_id and get_hit_sound:
if has_defense_anim:
print 'wmllint: "%s", line %d: unit%s has both deprecated get_hit_sound tag and a DEFENSE_ANIM"'%(filename, i+1, unit_id)
print 'wmllint: "%s", line %d: unit%s has both deprecated get_hit_sound key and a DEFENSE_ANIM'%(filename, get_hit_sound+1, unit_id)
else:
new_anim = "{DEFENSE_ANIM %s %s %s}" % \
(unit_image, unit_image, unit_sound)
(key, prefix, val, comment) = parse_attribute(lines[get_hit_sound])
print 'wmllint: "%s", line %d: unit%s gets %s'%(filename, get_hit_sound, unit_id, new_anim)
print 'wmllint: "%s", line %d: unit%s gets %s'%(filename, get_hit_sound+1, unit_id, new_anim)
lines[get_hit_sound] = leader(lines[get_hit_sound]) \
+ new_anim + comment
modcount += 1