hedgewars/uGears.pas
changeset 11705 4b2179d9516c
parent 11703 607e2e43acf0
child 11734 f48408dcea36
equal deleted inserted replaced
11704:1694b379c83f 11705:4b2179d9516c
   827     sectionDivide:= (ClansCount = 2);
   827     sectionDivide:= (ClansCount = 2);
   828 
   828 
   829 // in section-divide mode, divide the map into equal-width sections and put each clan in one of them
   829 // in section-divide mode, divide the map into equal-width sections and put each clan in one of them
   830 if sectionDivide then
   830 if sectionDivide then
   831     begin
   831     begin
   832     t:= 0;
   832     t:= leftX;
   833     for p:= 0 to (ClansCount - 1) do
   833     for p:= 0 to (ClansCount - 1) do
   834         begin
   834         begin
   835         with ClansArray[p]^ do
   835         with ClansArray[p]^ do
   836             for j:= 0 to Pred(TeamsNumber) do
   836             for j:= 0 to Pred(TeamsNumber) do
   837                 with Teams[j]^ do
   837                 with Teams[j]^ do
   840                             if (Gear <> nil) and (Gear^.X.QWordValue = 0) then
   840                             if (Gear <> nil) and (Gear^.X.QWordValue = 0) then
   841                                 begin
   841                                 begin
   842                                 if PlacingHogs then
   842                                 if PlacingHogs then
   843                                     Unplaced:= true
   843                                     Unplaced:= true
   844                                 else
   844                                 else
   845                                     FindPlace(Gear, false, t, t + LAND_WIDTH div ClansCount, true);// could make Gear == nil;
   845                                     FindPlace(Gear, false, t, t + playWidth div ClansCount, true);// could make Gear == nil;
   846                                 if Gear <> nil then
   846                                 if Gear <> nil then
   847                                     begin
   847                                     begin
   848                                     Gear^.Pos:= GetRandom(49);
   848                                     Gear^.Pos:= GetRandom(49);
   849                                     // unless the world is wrapping, make outter teams face to map center
   849                                     // unless the world is wrapping, make outter teams face to map center
   850                                     if (WorldEdge <> weWrap) and ((p = 0) or (p = ClansCount - 1)) then
   850                                     if (WorldEdge <> weWrap) and ((p = 0) or (p = ClansCount - 1)) then
   851                                         Gear^.dX.isNegative:= (p <> 0)
   851                                         Gear^.dX.isNegative:= (p <> 0)
   852                                     else
   852                                     else
   853                                         Gear^.dX.isNegative:= (GetRandom(2) = 1);
   853                                         Gear^.dX.isNegative:= (GetRandom(2) = 1);
   854                                     end
   854                                     end
   855                                 end;
   855                                 end;
   856         inc(t, LAND_WIDTH div ClansCount);
   856         inc(t, playWidth div ClansCount);
   857         end
   857         end
   858     end 
   858     end 
   859 else // mix hedgehogs
   859 else // mix hedgehogs
   860     begin
   860     begin
   861     Count:= 0;
   861     Count:= 0;
   874         begin
   874         begin
   875         i:= GetRandom(Count);
   875         i:= GetRandom(Count);
   876         if PlacingHogs then
   876         if PlacingHogs then
   877             ar[i]^.Unplaced:= true
   877             ar[i]^.Unplaced:= true
   878         else
   878         else
   879             FindPlace(ar[i]^.Gear, false, 0, LAND_WIDTH, true);
   879             FindPlace(ar[i]^.Gear, false, leftX, playWidth, true);
   880         if ar[i]^.Gear <> nil then
   880         if ar[i]^.Gear <> nil then
   881             begin
   881             begin
   882             ar[i]^.Gear^.dX.isNegative:= hwRound(ar[i]^.Gear^.X) > LAND_WIDTH div 2;
   882             ar[i]^.Gear^.dX.isNegative:= hwRound(ar[i]^.Gear^.X) > leftX + playWidth div 2;
   883             ar[i]^.Gear^.Pos:= GetRandom(19)
   883             ar[i]^.Gear^.Pos:= GetRandom(19)
   884             end;
   884             end;
   885         ar[i]:= ar[Count - 1];
   885         ar[i]:= ar[Count - 1];
   886         dec(Count)
   886         dec(Count)
   887         end
   887         end