Author: esr
Date: Tue Apr 28 19:56:17 2009
New Revision: 35300

URL: http://svn.gna.org/viewcvs/wesnoth?rev=35300&view=rev
Log:
Fix errors in trackplacer's overlap detector.

Modified:
    trunk/data/campaigns/An_Orcish_Incursion/utils/journey.cfg
    trunk/data/tools/trackplacer

Modified: trunk/data/campaigns/An_Orcish_Incursion/utils/journey.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/campaigns/An_Orcish_Incursion/utils/journey.cfg?rev=35300&r1=35299&r2=35300&view=diff
==============================================================================
--- trunk/data/campaigns/An_Orcish_Incursion/utils/journey.cfg (original)
+++ trunk/data/campaigns/An_Orcish_Incursion/utils/journey.cfg Tue Apr 28 
19:56:17 2009
@@ -114,6 +114,7 @@
     {OLD_JOURNEY 284 89}
     {OLD_JOURNEY 298 83}
     {OLD_BATTLE 309 76}
+    {NEW_JOURNEY 325 65}
     {NEW_BATTLE 337 53}
 #enddef
 
@@ -134,6 +135,7 @@
     {OLD_JOURNEY 284 89}
     {OLD_JOURNEY 298 83}
     {OLD_BATTLE 309 76}
+    {OLD_JOURNEY 325 65}
     {NEW_BATTLE 337 53}
 #enddef
 
@@ -154,6 +156,7 @@
     {OLD_JOURNEY 284 89}
     {OLD_JOURNEY 298 83}
     {OLD_BATTLE 309 76}
+    {OLD_JOURNEY 325 65}
     {OLD_BATTLE 337 53}
     {NEW_BATTLE 368 60}
 #enddef
@@ -175,6 +178,7 @@
     {OLD_JOURNEY 284 89}
     {OLD_JOURNEY 298 83}
     {OLD_BATTLE 309 76}
+    {OLD_JOURNEY 325 65}
     {OLD_BATTLE 337 53}
     {NEW_BATTLE 368 60}
 #enddef
@@ -196,6 +200,7 @@
     {OLD_JOURNEY 284 89}
     {OLD_JOURNEY 298 83}
     {OLD_BATTLE 309 76}
+    {OLD_JOURNEY 325 65}
     {OLD_BATTLE 337 53}
     {OLD_BATTLE 368 60}
     {NEW_BATTLE 381 30}
@@ -218,6 +223,7 @@
     {OLD_JOURNEY 284 89}
     {OLD_JOURNEY 298 83}
     {OLD_BATTLE 309 76}
+    {OLD_JOURNEY 325 65}
     {OLD_BATTLE 337 53}
     {OLD_BATTLE 368 60}
     {NEW_BATTLE 381 30}
@@ -240,6 +246,7 @@
     {OLD_JOURNEY 284 89}
     {OLD_JOURNEY 298 83}
     {OLD_BATTLE 309 76}
+    {OLD_JOURNEY 325 65}
     {OLD_BATTLE 337 53}
     {OLD_BATTLE 368 60}
     {OLD_BATTLE 381 30}

Modified: trunk/data/tools/trackplacer
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/trackplacer?rev=35300&r1=35299&r2=35300&view=diff
==============================================================================
--- trunk/data/tools/trackplacer (original)
+++ trunk/data/tools/trackplacer Tue Apr 28 19:56:17 2009
@@ -121,20 +121,22 @@
 
 def within(x, y, (l, t, r, d)):
     "Is point within specified rectangle?"
-    if x >= l and x < l + r and y >= t and y < t + d:
+    if x >= l and x <= l + r - 1 and y >= t and y <= t + d - 1:
         return True
     return False
 
 def overlaps((x1,y1,x1d,y1d),(x2,y2,x2d,y2d)):
     "Do two rectangles overlap?"
-    return within(x1, y1, (x2, y2, x2, y2d)) or \
-           within(x1+x1d-1, y1, (x2, y2, x2, y2d)) or \
-           within(x1, y1+y1d-1, (x2, y2, x2, y2d)) or \
-           within(x1+x1d-1, y1+y1d+1, (x2, y2, x2, y2d)) or \
-           within(x2, y2, (x1, y1, x1, y1d)) or \
-           within(x2+x2d-2, y2, (x1, y1, x1, y1d)) or \
-           within(x2, y2+y2d-2, (x1, y1, x1, y1d)) or \
-           within(x2+x2d-2, y2+y2d+2, (x1, y1, x1, y1d))
+    (x1,y1,x1d,y1d) = p1
+    (x2,y2,x2d,y2d) = p2
+    return within(x1,     y1,     p2) or \
+           within(x1+x1d, y1,     p2) or \
+           within(x1,     y1+y1d, p2) or \
+           within(x1+x1d, y1+y1d, p2) or \
+           within(x2,     y2,     p1) or \
+           within(x2+x2d, y2,     p1) or \
+           within(x2,     y2+y2d, p1) or \
+           within(x2+x2d, y2+y2d, p1)
 
 class JourneyTracks:
     "Represent a set of named journey tracks on a map."
@@ -719,7 +721,7 @@
 
     def box(self, (action, x, y)):
         "Compute the bounding box for an icon of type ACTION at X, Y."
-        # Assumers selected and unselected icons are the same size
+        # Assumes selected and unselected icons are the same size
         return self.selected_dictionary[action].bounding_box(x, y)
 
     def snap_to(self, x, y):


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

Reply via email to