hedgewars/uGears.pas
changeset 2771 477957a89881
parent 2770 851313907bcb
child 2786 85f6425a4d74
equal deleted inserted replaced
2770:851313907bcb 2771:477957a89881
  1773 procedure AssignHHCoords;
  1773 procedure AssignHHCoords;
  1774 var i, t, p, j: LongInt;
  1774 var i, t, p, j: LongInt;
  1775 	ar: array[0..Pred(cMaxHHs)] of PHedgehog;
  1775 	ar: array[0..Pred(cMaxHHs)] of PHedgehog;
  1776 	Count: Longword;
  1776 	Count: Longword;
  1777 begin
  1777 begin
       
  1778 if (GameFlags and gfPlaceHog) <> 0 then PlacingHogs:= true;
  1778 if (GameFlags and (gfForts or gfDivideTeams)) <> 0 then
  1779 if (GameFlags and (gfForts or gfDivideTeams)) <> 0 then
  1779 	begin
  1780 	begin
  1780 	t:= 0;
  1781 	t:= 0;
  1781 	TryDo(ClansCount = 2, 'More or less than 2 clans on map in divided teams mode!', true);
  1782 	TryDo(ClansCount = 2, 'More or less than 2 clans on map in divided teams mode!', true);
  1782 	for p:= 0 to 1 do
  1783 	for p:= 0 to 1 do
  1786 				with Teams[j]^ do
  1787 				with Teams[j]^ do
  1787 					for i:= 0 to cMaxHHIndex do
  1788 					for i:= 0 to cMaxHHIndex do
  1788 						with Hedgehogs[i] do
  1789 						with Hedgehogs[i] do
  1789 							if (Gear <> nil) and (Gear^.X.QWordValue = 0) then
  1790 							if (Gear <> nil) and (Gear^.X.QWordValue = 0) then
  1790 								begin
  1791 								begin
  1791                                 FindPlace(Gear, false, t, t + LAND_WIDTH div 2);// could make Gear == nil
  1792                                 if PlacingHogs then Unplaced:= true
       
  1793                                 else FindPlace(Gear, false, t, t + LAND_WIDTH div 2);// could make Gear == nil;
  1792 								if Gear <> nil then
  1794 								if Gear <> nil then
  1793 									begin
  1795 									begin
  1794 									Gear^.Pos:= GetRandom(49);
  1796 									Gear^.Pos:= GetRandom(49);
  1795 									Gear^.dX.isNegative:= p = 1;
  1797 									Gear^.dX.isNegative:= p = 1;
  1796 									end
  1798 									end
  1797 								end;
  1799 								end;
  1798 		t:= LAND_WIDTH div 2
  1800 		t:= LAND_WIDTH div 2
  1799 		end
  1801 		end
  1800 	end else // mix hedgehogs
  1802 	end else // mix hedgehogs
  1801 	begin
  1803 	begin
  1802     if (GameFlags and gfPlaceHog) <> 0 then PlacingHogs:= true;
       
  1803 	Count:= 0;
  1804 	Count:= 0;
  1804 	for p:= 0 to Pred(TeamsCount) do
  1805 	for p:= 0 to Pred(TeamsCount) do
  1805 		with TeamsArray[p]^ do
  1806 		with TeamsArray[p]^ do
  1806 		begin
  1807 		begin
  1807 		for i:= 0 to cMaxHHIndex do
  1808 		for i:= 0 to cMaxHHIndex do