diff --git a/data/tools/unit_tree/animations.py b/data/tools/unit_tree/animations.py index 9eabb3fccdf..4c8bf8e4bb4 100644 --- a/data/tools/unit_tree/animations.py +++ b/data/tools/unit_tree/animations.py @@ -156,11 +156,11 @@ td.none {border: solid 1px; background-color: #ffffff;} f.write("total frames (number of animations)\n") f.write("

Mainline

\n") - us = [x for x in wesnoth.unit_lookup.values() if x.campaign == "mainline"] + us = [x for x in wesnoth.unit_lookup.values() if x.campaigns[0] == "mainline"] put_units(f, us) f.write("

Campaigns and Addons

\n") - us = [x for x in wesnoth.unit_lookup.values() if x.campaign != "mainline"] + us = [x for x in wesnoth.unit_lookup.values() if x.campaigns[0] != "mainline"] put_units(f, us) f.write("") diff --git a/data/tools/unit_tree/helpers.py b/data/tools/unit_tree/helpers.py index 08ef96f2089..261141dff9e 100755 --- a/data/tools/unit_tree/helpers.py +++ b/data/tools/unit_tree/helpers.py @@ -278,13 +278,14 @@ class WesnothList: unit.get_text_val("hide_help", "no") in ["no", "false"]: uid = unit.get_text_val("id") if uid in self.unit_lookup: - pass + unit = self.unit_lookup[uid] # TODO: We might want to compare the two units # with the same id and if one is different try # to do something clever like rename it... else: self.unit_lookup[uid] = unit - unit.campaign = campaign + if not hasattr(unit, "campaigns"): unit.campaigns = [] + unit.campaigns.append(campaign) # Find all races. newraces = getall("race") diff --git a/data/tools/wmlunits b/data/tools/wmlunits index 92be42dd70d..905b8d6a2b2 100755 --- a/data/tools/wmlunits +++ b/data/tools/wmlunits @@ -89,7 +89,7 @@ class GroupByRace: def unitfilter(self, unit): if not self.campaign: return True - return unit.campaign == self.campaign + return self.campaign in unit.campaigns def groups(self, unit): return [unit.race] @@ -338,14 +338,14 @@ class HTMLOutput: r = {}, {} for u in self.wesnoth.unit_lookup.values(): - if u.campaign != self.campaign: continue + if self.campaign not in u.campaigns: continue race = u.race racename = T(race, "plural_name") m = 1 - if u and u.campaign in self.wesnoth.is_mainline_campaign: + if u and u.campaigns[0] in self.wesnoth.is_mainline_campaign: m = 0 - if u.campaign == "mainline": + if u.campaigns[0] == "mainline": m = 0 r[m][racename] = race.get_text_val("id") racenames = sorted(r[0].items()) @@ -384,7 +384,7 @@ class HTMLOutput: races = {} for uid, u in self.wesnoth.unit_lookup.items(): - if u.campaign != camp: continue + if camp not in u.campaigns: continue if u.race: racename = T(u.race, "plural_name") else: @@ -465,10 +465,10 @@ class HTMLOutput: "Warning: Missing image for unit %s(%s).\n" % ( u.get_text_val("id"), x.name)) return None, None - picname = image_collector.add_image(u.campaign, image) + picname = image_collector.add_image(u.campaigns[0], image) image = os.path.join("../pics", picname) if portrait: - picname = image_collector.add_image(u.campaign, portrait, + picname = image_collector.add_image(u.campaigns[0], portrait, no_tc=True) portrait = os.path.join("../pics", picname) return image, portrait @@ -745,7 +745,7 @@ class HTMLOutput: write("\n") for pid in self.forest.get_parents(uid): punit = self.wesnoth.unit_lookup[pid] - if unit.campaign == "mainline" and punit.campaign != "mainline": + if unit.campaigns[0] == "mainline" and punit.campaigns[0] != "mainline": continue link = "../%s/%s.html" % (self.isocode, pid) name = self.wesnoth.get_unit_value(punit, "name", @@ -759,14 +759,14 @@ class HTMLOutput: link = "../%s/%s.html" % (self.isocode, cid) try: cunit = self.wesnoth.unit_lookup[cid] - if unit.campaign == "mainline" and cunit.campaign != "mainline": + if unit.campaigns[0] == "mainline" and cunit.campaigns[0] != "mainline": continue name = self.wesnoth.get_unit_value(cunit, "name", translation=self.translation.translate) except KeyError: error_message("Warning: Unit %s not found.\n" % cid) name = cid - if unit.campaign == "mainline": continue + if unit.campaigns[0] == "mainline": continue write("\n%s" % (link, name)) write("\n") write("\n") @@ -812,7 +812,7 @@ class HTMLOutput: icon = "attacks/%s.png" % aid picname, error = image_collector.add_image_check( - unit.campaign, icon, no_tc=True) + unit.campaigns[0], icon, no_tc=True) if error: error_message("Error: No attack icon '%s' found for '%s'.\n" % ( icon, uid)) @@ -924,6 +924,7 @@ class HTMLOutput: elif tid == "frozen": ticon = "frozen/ice" elif tid == "unwalkable": ticon = "unwalkable/lava" elif tid == "village": ticon = "village/human-tile" + elif tid == "forest": ticon = "forest/pine-tile" terrainlist.append((name, tid, ticon)) terrainlist.sort() @@ -1263,10 +1264,10 @@ if __name__ == '__main__': u = wesnoth.unit_lookup[uid] if u.rid != race: if race != None: f.write("") - f.write("

%s

\n" % u.rid) + f.write("

%s

\n" % (u.rid,)) f.write("") f.write("") f.close()