Fix DrawHLinesExplosions setting invalid map pixels if called at wrap world edge
authorWuzzy <Wuzzy2@mail.ru>
Sat, 28 Jul 2018 13:15:59 +0200
changeset 13567 8f9b84d6991d
parent 13566 acc69f506914
child 13568 470982c05f7e
Fix DrawHLinesExplosions setting invalid map pixels if called at wrap world edge This caused an errror message after the game when using hammer or pickhammer at wrap world edge.
ChangeLog.txt
hedgewars/uLandGraphics.pas
--- a/ChangeLog.txt	Fri Jul 27 19:58:02 2018 +0200
+++ b/ChangeLog.txt	Sat Jul 28 13:15:59 2018 +0200
@@ -9,6 +9,7 @@
  + Increase hedgehog limit to 64
  * Functionality of controllers restored
  * Fix crash when 2 or more controllers were connected
+ * Fix hammer and pickhammer not digging correctly at wrap world edge
  * Fix extreme amounts of droplets when shooting with minigun into ocean world edge
  * Fix hog being unable to walk after using sniper rifle without firing both shots
  * Fix video recorder not working when game audio was disabled
--- a/hedgewars/uLandGraphics.pas	Fri Jul 27 19:58:02 2018 +0200
+++ b/hedgewars/uLandGraphics.pas	Sat Jul 28 13:15:59 2018 +0200
@@ -473,8 +473,8 @@
 begin
 for i:= 0 to Pred(Count) do
     begin
-    for ty:= Max(y - Radius, 0) to Min(y + Radius, LAND_HEIGHT) do
-        for tx:= Max(0, ar^[i].Left - Radius) to Min(LAND_WIDTH, ar^[i].Right + Radius) do
+    for ty:= Max(y - Radius, 0) to Min(y + Radius, TopY) do
+        for tx:= Max(LeftX, ar^[i].Left - Radius) to Min(RightX, ar^[i].Right + Radius) do
             begin
             if (Land[ty, tx] and lfIndestructible) = 0 then
                 begin
@@ -500,8 +500,8 @@
 
 for i:= 0 to Pred(Count) do
     begin
-    for ty:= Max(y - Radius, 0) to Min(y + Radius, LAND_HEIGHT) do
-        for tx:= Max(0, ar^[i].Left - Radius) to Min(LAND_WIDTH, ar^[i].Right + Radius) do
+    for ty:= Max(y - Radius, 0) to Min(y + Radius, TopY) do
+        for tx:= Max(LeftX, ar^[i].Left - Radius) to Min(RightX, ar^[i].Right + Radius) do
             if ((Land[ty, tx] and lfBasic) <> 0) or ((Land[ty, tx] and lfObject) <> 0) then
                 begin
                  if (cReducedQuality and rqBlurryLand) = 0 then