mail[Wesnoth-commits] r25382 - /trunk/data/tools/wmlunits


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by esr on March 31, 2008 - 17:19:
Author: esr
Date: Mon Mar 31 17:19:08 2008
New Revision: 25382

URL: http://svn.gna.org/viewcvs/wesnoth?rev=25382&view=rev
Log:
Correct a coding error introduced in last commit.

Modified:
    trunk/data/tools/wmlunits

Modified: trunk/data/tools/wmlunits
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/wmlunits?rev=25382&r1=25381&r2=25382&view=diff
==============================================================================
--- trunk/data/tools/wmlunits (original)
+++ trunk/data/tools/wmlunits Mon Mar 31 17:19:08 2008
@@ -40,13 +40,12 @@
             parser.parse_file(os.path.join(units_filename))
         parser.parse_top(WML)
 
+        self.campaign = campaign
+
        # Collect unit data
-        newunits = WML.get_first("+units").get_all("unit_type")
-        for unit in newunits:
-            unit.campaign = campaign
-        self.units_by_campaign[campaign] = newunits
+        self.units_by_campaign[campaign] = 
WML.get_first("+units").get_all("unit_type")
 
-def report_unit_names(unitlist, isocode):
+def report_unit_names(campaign, unitlist, isocode):
     tx = None
     doubles = {}
     races = {}
@@ -76,9 +75,9 @@
         r = r[0].upper() + r[1:]
         l = u.get_text_val("level")
         levels = races.get(r, {})
-        unitlist = levels.get(l, [])
-        unitlist.append(u)
-        levels[l] = unitlist
+        ulist = levels.get(l, [])
+        ulist.append(u)
+        levels[l] = ulist
         races[r] = levels
 
     def poname(name):
@@ -86,10 +85,10 @@
 
     def place_units(race):
         if use_html:
-            print "<font size=5>%s</font>" % (race + description)
+            print "<font size=5>%s - %s</font>" % (race, campaign)
             print "<table border=solid>"
         else:
-            print '| colspan="6" | <font size=5>%s</font>' % (race + 
description)
+            print '| colspan="6" | <font size=5>%s - %s</font>' % (race, 
campaign)
             print '|-'
             print '| level 0 || level 1 || level 2 || level 3 || level 4 || 
level 5'
         levels = []
@@ -189,8 +188,8 @@
     else:
         print '{| border="solid"'
 
-    for unitgroup in unitlist.units_by_campaign.values():
-        report_unit_names(unitgroup, isocode)
+    for (campaign, unitgroup) in unitlist.units_by_campaign.items():
+        report_unit_names(campaign, unitgroup, isocode)
 
     if use_html:
         print "</body></html>"




Related Messages


Powered by MHonArc, Updated Mon Mar 31 17:21:37 2008