# HG changeset patch # User nemo # Date 1451592704 18000 # Node ID 8c95d5a4366c857f8f6be387d97c5250e06f4407 # Parent e425a6eb9da3d377d9f97d1bb267cee379d85314 Tweak the hole carving to become less agressive about spacing if random points keep failing. diff -r e425a6eb9da3 -r 8c95d5a4366c hedgewars/uGears.pas --- a/hedgewars/uGears.pas Thu Dec 31 12:47:33 2015 -0500 +++ b/hedgewars/uGears.pas Thu Dec 31 15:11:44 2015 -0500 @@ -808,6 +808,15 @@ if (Gear <> nil) and (Gear^.State and gsttmpFlag <> 0) then begin DrawExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50); + AddFileLog('Carved a hole for hog at coordinates (' + inttostr(hwRound(Gear^.X)) + ',' + inttostr(hwRound(Gear^.Y)) + ')') + end; +// place flowers after in case holes overlap (we shrink search distance if we are failing to place) +for p:= 0 to Pred(TeamsCount) do + with TeamsArray[p]^ do + for i:= 0 to cMaxHHIndex do + with Hedgehogs[i] do + if (Gear <> nil) and (Gear^.State and gsttmpFlag <> 0) then + begin ForcePlaceOnLand(hwRound(Gear^.X) - SpritesData[sprTargetBee].Width div 2, hwRound(Gear^.Y) - SpritesData[sprTargetBee].Height div 2, sprTargetBee, 0, lfBasic, $FFFFFFFF, false, false, false); diff -r e425a6eb9da3 -r 8c95d5a4366c hedgewars/uGearsUtils.pas --- a/hedgewars/uGearsUtils.pas Thu Dec 31 12:47:33 2015 -0500 +++ b/hedgewars/uGearsUtils.pas Thu Dec 31 15:11:44 2015 -0500 @@ -939,9 +939,9 @@ while (cnt < 1000) do begin inc(cnt); - x:= leftX+GetRandom(rightX-leftX-16)+8; - y:= topY+GetRandom(LAND_HEIGHT-topY-16)+8; - if NoGearsToAvoid(x, y, 100, 100) then + x:= leftX+GetRandom(rightX-leftX-32)+16; + y:= topY+GetRandom(LAND_HEIGHT-topY-32)+16; + if NoGearsToAvoid(x, y, 100 div max(1,cnt div 100), 100 div max(1,cnt div 100)) then begin Gear^.State:= Gear^.State or gsttmpFlag; Gear^.X:= int2hwFloat(x);