wmlunits: Fix exception for missing female unit names in EoM,
...and ignore units with hide_help.
This commit is contained in:
parent
28c669f48d
commit
3a41dc633d
2 changed files with 12 additions and 8 deletions
|
@ -248,7 +248,8 @@ class WesnothList:
|
|||
# Find all unit types.
|
||||
newunits = getall("unit_type") + getall("unit")
|
||||
for unit in newunits:
|
||||
if unit.get_text_val("do_not_list", "no") == "no":
|
||||
if unit.get_text_val("do_not_list", "no") == "no" and\
|
||||
unit.get_text_val("hide_help", "no") in ["no", "false"]:
|
||||
uid = unit.get_text_val("id")
|
||||
self.unit_lookup[uid] = unit
|
||||
unit.campaign = campaign
|
||||
|
@ -344,7 +345,7 @@ class UnitForest:
|
|||
self.lookup[un.id] = un
|
||||
|
||||
# First, we check if any of the new node's advancements already is in
|
||||
# the forest. If so, remove it and attach it to the new node.
|
||||
# the tree. If so, attach it to the new node.
|
||||
for cid in un.child_ids:
|
||||
if cid in self.trees:
|
||||
un.children.append(self.trees[cid])
|
||||
|
@ -354,8 +355,9 @@ class UnitForest:
|
|||
# Next, we check if the node is an advancement of an existing node. If
|
||||
# so, add it there.
|
||||
for rootnode in self.trees.values():
|
||||
if rootnode.try_add(un):
|
||||
return
|
||||
# Because multiple units might advance into this one, we do not
|
||||
# stop after a successful insertion.
|
||||
rootnode.try_add(un)
|
||||
|
||||
# Else, add a new tree with the new node as root.
|
||||
self.trees[un.id] = un
|
||||
|
|
|
@ -418,7 +418,7 @@ class HTMLOutput:
|
|||
female = unit.get_first("female")
|
||||
if female:
|
||||
fname = female.get_text_val("name")
|
||||
if fname != uname:
|
||||
if fname and fname != uname:
|
||||
display_name += "<br/>" + fname
|
||||
|
||||
write("<h1>%s</h1>\n" % display_name)
|
||||
|
@ -755,7 +755,7 @@ def output(isocode):
|
|||
n = stuff.add_addons(image_collector)
|
||||
print "%d units found." % n
|
||||
|
||||
stuff.find_unit_factions()
|
||||
stuff.find_unit_factions()
|
||||
|
||||
# Report generation
|
||||
if not os.path.isdir(options.output):
|
||||
|
@ -798,9 +798,11 @@ if __name__ == '__main__':
|
|||
op.add_option("-n", "--nocopy", action = "store_true",
|
||||
help = "No copying of files.")
|
||||
op.add_option("-d", "--datadir",
|
||||
help = "Specify Wesnoth's data to use. Default is to search current directory upwards.")
|
||||
help = "Specify Wesnoth's data to use. Default is to search current "+\
|
||||
"directory upwards.")
|
||||
op.add_option("-u", "--userdir",
|
||||
help = "Specify user data dir to use, which is automatically scanned for addons. For example -u ~/.wesnoth/data")
|
||||
help = "Specify user data dir to use, which is automatically scanned "+\
|
||||
"for addons. For example -u ~/.wesnoth/data")
|
||||
op.add_option("-t", "--transdir",
|
||||
help = "Specify directory which has a po subfolder for translations.")
|
||||
options, args = op.parse_args()
|
||||
|
|
Loading…
Add table
Reference in a new issue