[wmlunits] fixed small bug in [specials] handling

This commit is contained in:
Elias Pschernig 2011-06-05 13:10:35 +00:00
parent 4f42ca826c
commit 5d57f537bd
3 changed files with 14 additions and 4 deletions

View file

@ -234,6 +234,8 @@ class WesnothList:
def add_campaign_units(self, cname, image_collector):
campaign = self.campaign_lookup[cname]
define = campaign.get_text_val("define")
if not define:
return 0
self.parser.parse_text("{campaigns}", define + ",NORMAL")
image_collector.add_binary_paths_from_WML(cname,

View file

@ -122,6 +122,12 @@ class TagNode:
unit.get_all()
will return 4 nodes for all 4 sub-elements.
unit.get_all(att = "")
Will return the two attribute nodes.
unit.get_all(tag = "")
Will return the two tag nodes.
If no elements are found an empty list is returned.
"""
@ -134,10 +140,10 @@ class TagNode:
for k, v in kw.items():
if k == "tag":
if not isinstance(sub, TagNode): ok = False
elif not sub.name == v: ok = False
elif v == "" or not sub.name == v: ok = False
elif k == "att":
if not isinstance(sub, AttributeNode): ok = False
elif not sub.name == v: ok = False
elif v == "" or not sub.name == v: ok = False
if ok:
r.append(sub)
return r

View file

@ -519,7 +519,7 @@ class HTMLOutput:
s = []
specials = attack.get_all(tag = "specials")
if specials:
for special in specials[0].get_all():
for special in specials[0].get_all(tag = ""):
sname = T(special, "name")
if sname:
s.append(sname)
@ -709,7 +709,7 @@ class HTMLOutput:
s = []
specials = attack.get_all(tag = "specials")
if specials:
for special in specials[0].get_all():
for special in specials[0].get_all(tag = ""):
sname = T(special, "name")
if sname:
s.append(sname)
@ -970,6 +970,8 @@ def generate_report(stuff, isocode):
* Each addon era's units sorted by faction
* Each addon campaign's units sorted by race
"""
if not isocode: return
print "Generating report for %s." % (isocode)
reset_errors()