Author: shadowmaster
Date: Tue Aug  2 02:38:36 2011
New Revision: 50543

URL: http://svn.gna.org/viewcvs/wesnoth?rev=50543&view=rev
Log:
wmllint: Handle deprecated implicit side=1 in more actions; run the new code in 
mainline

Shame on you, esr.

This commit handles [remove/place_shroud], [gold] and [modify_side/ai]
using modified code derived from patch #2666

Modified:
    trunk/changelog
    trunk/data/campaigns/Dead_Water/scenarios/10_The_Flaming_Sword.cfg
    trunk/data/campaigns/Sceptre_of_Fire/scenarios/2_Closing_the_Gates.cfg
    trunk/data/campaigns/Two_Brothers/scenarios/03_Guarded_Castle.cfg
    
trunk/data/campaigns/Under_the_Burning_Suns/scenarios/02_Across_the_Harsh_Sands.cfg
    trunk/data/core/macros/items.cfg
    trunk/data/tools/wmllint

Modified: trunk/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=50543&r1=50542&r2=50543&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Tue Aug  2 02:38:36 2011
@@ -64,7 +64,8 @@
        * decreased the impact resist of the Falcon line from 0% to -10%
        * The Naffat line (Naffat, Qatif-al-nar, Tineen) is no longer able to 
get the strong trait
  * Miscellaneous and bug fixes:
-   * Teach wmllint to fix deprecated implicit side=1 in [store_gold] actions
+   * Teach wmllint to fix deprecated implicit side=1 in [store_gold], 
[remove_shroud],
+     [place_shroud], [gold], [modify_side], [modify_ai] actions
 
 Version 1.9.8:
  * Campaigns:

Modified: trunk/data/campaigns/Dead_Water/scenarios/10_The_Flaming_Sword.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/campaigns/Dead_Water/scenarios/10_The_Flaming_Sword.cfg?rev=50543&r1=50542&r2=50543&view=diff
==============================================================================
--- trunk/data/campaigns/Dead_Water/scenarios/10_The_Flaming_Sword.cfg 
(original)
+++ trunk/data/campaigns/Dead_Water/scenarios/10_The_Flaming_Sword.cfg Tue Aug  
2 02:38:36 2011
@@ -310,6 +310,7 @@
             [then]
                 [gold]
                     amount=20
+                    side=1
                 [/gold]
             [/then]
         [/if]

Modified: trunk/data/campaigns/Sceptre_of_Fire/scenarios/2_Closing_the_Gates.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/campaigns/Sceptre_of_Fire/scenarios/2_Closing_the_Gates.cfg?rev=50543&r1=50542&r2=50543&view=diff
==============================================================================
--- trunk/data/campaigns/Sceptre_of_Fire/scenarios/2_Closing_the_Gates.cfg 
(original)
+++ trunk/data/campaigns/Sceptre_of_Fire/scenarios/2_Closing_the_Gates.cfg Tue 
Aug  2 02:38:36 2011
@@ -130,6 +130,7 @@
 
         [remove_shroud]
             find_in=locations_outside
+            side=1
         [/remove_shroud]
 
         {GENERIC_UNIT 3 "Troll Whelp" 6 3}
@@ -552,6 +553,7 @@
                         x=10,   11,   12,   13,   14
                         y=13,13-14,13-14,14-15,14-15
                     [/not]
+                    side=1
                 [/place_shroud]
                 [if]
                     [have_unit]

Modified: trunk/data/campaigns/Two_Brothers/scenarios/03_Guarded_Castle.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/campaigns/Two_Brothers/scenarios/03_Guarded_Castle.cfg?rev=50543&r1=50542&r2=50543&view=diff
==============================================================================
--- trunk/data/campaigns/Two_Brothers/scenarios/03_Guarded_Castle.cfg (original)
+++ trunk/data/campaigns/Two_Brothers/scenarios/03_Guarded_Castle.cfg Tue Aug  
2 02:38:36 2011
@@ -767,6 +767,7 @@
         [remove_shroud]
             x=1-8,9-10,5
             y=1-12,1-7,13
+            side=1
         [/remove_shroud]
     [/event]
 

Modified: 
trunk/data/campaigns/Under_the_Burning_Suns/scenarios/02_Across_the_Harsh_Sands.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/campaigns/Under_the_Burning_Suns/scenarios/02_Across_the_Harsh_Sands.cfg?rev=50543&r1=50542&r2=50543&view=diff
==============================================================================
--- 
trunk/data/campaigns/Under_the_Burning_Suns/scenarios/02_Across_the_Harsh_Sands.cfg
 (original)
+++ 
trunk/data/campaigns/Under_the_Burning_Suns/scenarios/02_Across_the_Harsh_Sands.cfg
 Tue Aug  2 02:38:36 2011
@@ -1422,6 +1422,7 @@
 #ifdef HARD
                         amount=150
 #endif
+                        side=1
                     [/gold]
                 [/event]
             [/then]

Modified: trunk/data/core/macros/items.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/core/macros/items.cfg?rev=50543&r1=50542&r2=50543&view=diff
==============================================================================
--- trunk/data/core/macros/items.cfg (original)
+++ trunk/data/core/macros/items.cfg Tue Aug  2 02:38:36 2011
@@ -27,6 +27,7 @@
                 [command]
                     [gold]
                         amount=-1
+                        side=1
                     [/gold]
                     [message]
                         speaker=unit

Modified: trunk/data/tools/wmllint
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/wmllint?rev=50543&r1=50542&r2=50543&view=diff
==============================================================================
--- trunk/data/tools/wmllint (original)
+++ trunk/data/tools/wmllint Tue Aug  2 02:38:36 2011
@@ -1600,6 +1600,49 @@
             lines[i] = lines[i].replace("{@campaigns/", "{~add-ons/")
         elif "@add-ons/" in lines[i]:
             lines[i] = lines[i].replace("{@add-ons/", "{~add-ons/")
+    # some tags do no longer support default side=1 attribute but may use 
[filter_side]
+    # with a SSF instead
+    # (since 1.9.5, 1.9.6)
+    side_one_tags_allowing_filter_side = (
+        ("remove_shroud"),
+        ("place_shroud"),
+        ("gold"),
+        ("modify_side"),
+        ("modify_ai")
+        )
+    outside_of_theme_wml = True # theme wml contains a [gold] tag - exclude 
that case
+    in_side_one_tag = False
+    side_one_tag_needs_side_one = True
+    for i in range(len(lines)):
+        if "no-syntax-rewrite" in lines[i]:
+            break
+        precomment = lines[i].split("#")[0]
+        if outside_of_theme_wml:
+            if "[theme]" in precomment:
+                outside_of_theme_wml = False
+        else:
+            if "[/theme]" in precomment:
+                outside_of_theme_wml = True
+        if outside_of_theme_wml:
+            if not in_side_one_tag:
+                for j in range(len(side_one_tags_allowing_filter_side)):
+                    if "[" + side_one_tags_allowing_filter_side[j] + "]" in 
precomment:
+                        in_side_one_tag = True
+            else:
+                if side_one_tag_needs_side_one:
+                    if "side=" in precomment:
+                        side_one_tag_needs_side_one = False
+                    if "[filter_side]" in precomment:
+                        side_one_tag_needs_side_one = False
+                for j in range(len(side_one_tags_allowing_filter_side)):
+                    if "[/" + side_one_tags_allowing_filter_side[j] + "]" in 
precomment:
+                        if side_one_tag_needs_side_one:
+                            if verbose:
+                                print '"%s", line %d: inserting 
"side=1"'%(filename, i+1)
+                            lines.insert(i, leader(precomment) + baseindent + 
"side=1\n")
+                        in_side_one_tag = False
+                        side_one_tag_needs_side_one = True
+                        break
     # More syntax transformations would go here.
     return lines
 


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

Reply via email to