Teach wmllint to detect missing side attribute in recruit,

...allow_recruit and disallow_recruit.  Fix all mainline instances of
this glitch.
This commit is contained in:
Eric S. Raymond 2011-07-03 10:55:21 +00:00
parent 52471abac6
commit f880c89e81
17 changed files with 28 additions and 2 deletions

View file

@ -301,6 +301,7 @@
{MODIFY_UNIT id=Delfador canrecruit yes}
{MEMOIRS_UNSTORE_UNITS delfador_elvish_veterans}
[disallow_recruit]
side=1
type={ELVES2}
[/disallow_recruit]
#enddef
@ -357,6 +358,7 @@
# store elves (to reappear later)
{MEMOIRS_STORE_UNITS delfador_elvish_veterans}
[disallow_recruit]
side=1
type={ELVES}
[/disallow_recruit]
#enddef
@ -439,6 +441,7 @@
#define DELFADOR_DEPARTS_AGAIN
# He's not going to be where he can recruit dwarves again.
[disallow_recruit]
side=1
type={DWARVES},{DWARVES2}
[/disallow_recruit]
# Delfador goes away
@ -488,9 +491,11 @@
[/not]
[/kill]
[disallow_recruit]
side=1
type={LOYALISTS}
[/disallow_recruit]
[disallow_recruit]
side=1
type=Mage, Arch Mage, Great Mage, Silver Mage, White Mage, Red Mage
[/disallow_recruit]
#enddef

View file

@ -348,6 +348,7 @@
upkeep=full
[/unit]
[allow_recruit]
side=1
type=Young Ogre
[/allow_recruit]
[message]

View file

@ -172,6 +172,7 @@
[/message]
{VARIABLE have_ogres yes}
[allow_recruit]
side=1
type=Young Ogre
[/allow_recruit]
[/then]

View file

@ -904,6 +904,7 @@
message= _ "You may now recruit the noble merfolk!"
[/message]
[allow_recruit]
side=1
type=Merman Fighter
[/allow_recruit]
[endlevel]
@ -935,6 +936,7 @@
message= _ "You may now recruit the noble merfolk!"
[/message]
[allow_recruit]
side=1
type=Merman Fighter
[/allow_recruit]
[endlevel]

View file

@ -302,6 +302,7 @@
value=yes
[/set_variable]
[allow_recruit]
side=1
type=Thief
[/allow_recruit]
[/command]
@ -405,6 +406,7 @@
[/message]
[/event]
[allow_recruit]
side=1
type=Thief
[/allow_recruit]
[/command]

View file

@ -644,6 +644,7 @@
[/move_unit_fake]
[allow_recruit]
side=1
type=Gryphon Rider
[/allow_recruit]

View file

@ -602,6 +602,7 @@
message= _ "You may now recruit the legendary dwarvish guardsmen!"
[/message]
[allow_recruit]
side=1
type=Dwarvish Guardsman
[/allow_recruit]
[/then]

View file

@ -435,6 +435,7 @@
message= _ "The mighty riders of the eastern plains, the Knights of the Clans, are now yours to command!"
[/message]
[allow_recruit]
side=1
type=Knight
[/allow_recruit]

View file

@ -397,6 +397,7 @@
[/message]
[allow_recruit]
side=1
type=Thief,Rogue Mage,Shadow Mage
[/allow_recruit]

View file

@ -397,6 +397,7 @@
random_traits=yes
[/unit]
[allow_recruit]
side=1
type=Gryphon Rider
[/allow_recruit]
[/event]

View file

@ -536,6 +536,7 @@
kill=yes
[/store_unit]
[set_recruit]
side=1
recruit=
[/set_recruit]
[objectives]

View file

@ -48,6 +48,7 @@ Mage,Red Mage,White Mage,Arch Mage,Great Mage,Mage of Light,Silver Mage #enddef
image=wesnoth-icon.png
[/message]
[disallow_recruit]
side=1
type=Mage
[/disallow_recruit]
{VARIABLE mage_disallow true}

View file

@ -239,6 +239,7 @@
message= _ "Why should I trust you, or your information? I dont even know your name, and you have this nasty habit of mysteriously vanishing!"
[/message]
[allow_recruit]
side=1
type=Footpad,Poacher,Thief,Thug
[/allow_recruit]
[/else]

View file

@ -977,6 +977,7 @@
[/message]
[allow_recruit]
side=1
type=Peasant
[/allow_recruit]

View file

@ -407,6 +407,7 @@
[/message]
[allow_recruit]
side=1
type=Merman Fighter,Merman Hunter
[/allow_recruit]
[objectives]

View file

@ -442,6 +442,7 @@ Besides... I want my brother back."
message= _ "Thank you. My comrades and I will help you on your noble quest."
[/message]
[allow_recruit]
side=1
type=Heavy Infantryman
[/allow_recruit]
[/command]
@ -454,6 +455,7 @@ Besides... I want my brother back."
message= _ "Take this, then, for I see that you are on a quest. My comrades will help you whenever you call for them."
[/message]
[allow_recruit]
side=1
type=Heavy Infantryman
[/allow_recruit]
[kill]

View file

@ -538,8 +538,8 @@ def validate_on_pop(tagstack, closer, filename, lineno):
if "units" not in filename and closer == "unit" and "race" in attributes:
print '"%s", line %d: [unit] needs hand fixup to [unit_type]' % \
(filename, lineno)
if closer in ["campaign" or "race"] and "id" not in attributes:
print '"%s", line %d: %s requires an ID field but has none' % \
if closer in ["campaign", "race"] and "id" not in attributes:
print '"%s", line %d: %s requires an ID attribute but has none' % \
(filename, lineno, closer)
if closer == "terrain" and attributes.get("heals") in ("true", "false"):
print '"%s", line %d: heals attribute no longer takes a boolean' % \
@ -547,6 +547,9 @@ def validate_on_pop(tagstack, closer, filename, lineno):
if closer == "unit" and attributes.get("id") is not None and attributes.get("type") is not None and attributes.get("side") is None and not "side" in ancestors:
print '"%s", line %d: unit declaration without side attribute' % \
(filename, lineno)
if closer in ["set_recruit", "allow_recruit", "disallow_recruit"] and "side" not in attributes:
print '"%s", line %d: %s requires "side" attribute but has none' % \
(filename, lineno, closer)
def within(tag):
"Did the specified tag lead one of our enclosing contexts?"