Author: elias
Date: Fri Oct  3 16:55:53 2008
New Revision: 29826

URL: http://svn.gna.org/viewcvs/wesnoth?rev=29826&view=rev
Log:
another go at fixing bug #12383

Modified:
    trunk/data/tools/wmlunits

Modified: trunk/data/tools/wmlunits
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/wmlunits?rev=29826&r1=29825&r2=29826&view=diff
==============================================================================
--- trunk/data/tools/wmlunits (original)
+++ trunk/data/tools/wmlunits Fri Oct  3 16:55:53 2008
@@ -604,12 +604,21 @@
             attacks = []
             if base_unit:
                 attacks = get_recursive_attacks(base_unit)
-            
+
+            base_attacks = attacks[:]
             for i, attack in enumerate(this_unit.get_all("attack")):
                 aid = attack.get_text_val("name")
                 if aid:
-                    attacks.append(attack)
+                    # The attack does have a name - either merge with the base
+                    # which has the same name, or else append it as new attack.
+                    for already in base_attacks:
+                        if already.get_text_val("name") == aid:
+                            copy_attributes(attack, already)
+                            break
+                    else:
+                        attacks.append(attack)
                 else:
+                    # The attack has no name, so merge based on order.
                     copy_attributes(attack, attacks[i])
             return attacks
 


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to