hedgewars/uGears.pas
changeset 11881 34ede05e4d4f
parent 11867 f6d33710baff
child 11887 083c12795632
equal deleted inserted replaced
11880:2eac7a96b342 11881:34ede05e4d4f
   811 
   811 
   812 procedure AssignHHCoords;
   812 procedure AssignHHCoords;
   813 var i, t, p, j: LongInt;
   813 var i, t, p, j: LongInt;
   814     ar: array[0..Pred(cMaxHHs)] of PHedgehog;
   814     ar: array[0..Pred(cMaxHHs)] of PHedgehog;
   815     Count: Longword;
   815     Count: Longword;
   816     divide, sectionDivide: boolean;
   816     divide: boolean;
   817 begin
   817 begin
   818 if (GameFlags and gfPlaceHog) <> 0 then
   818 if (GameFlags and gfPlaceHog) <> 0 then
   819     PlacingHogs:= true;
   819     PlacingHogs:= true;
   820 
   820 
   821 divide:= ((GameFlags and gfDivideTeams) <> 0);
   821 divide:= ((GameFlags and gfDivideTeams) <> 0);
   822 sectionDivide:= divide and ((GameFlags and gfForts) <> 0);
       
   823 
       
   824 // TODO: there might be a smarter way to decide if dividing clans into equal-width map sections makes sense
       
   825 // e.g. by checking if there is enough spawn area in each section
       
   826 if divide and (not sectionDivide) then
       
   827     sectionDivide:= (ClansCount = 2);
       
   828 
   822 
   829 // in section-divide mode, divide the map into equal-width sections and put each clan in one of them
   823 // in section-divide mode, divide the map into equal-width sections and put each clan in one of them
   830 if sectionDivide then
   824 if divide then
   831     begin
   825     begin
   832     t:= leftX;
   826     t:= leftX;
   833     for p:= 0 to (ClansCount - 1) do
   827     for p:= 0 to (ClansCount - 1) do
   834         begin
   828         begin
   835         with SpawnClansArray[p]^ do
   829         with SpawnClansArray[p]^ do
   910                     AddFileLog('Placed flower for hog at coordinates (' + inttostr(hwRound(Gear^.X)) + ',' + inttostr(hwRound(Gear^.Y)) + ')')
   904                     AddFileLog('Placed flower for hog at coordinates (' + inttostr(hwRound(Gear^.X)) + ',' + inttostr(hwRound(Gear^.Y)) + ')')
   911                     end;
   905                     end;
   912 
   906 
   913 
   907 
   914 // divided teams: sort the hedgehogs from left to right by clan and shuffle clan members
   908 // divided teams: sort the hedgehogs from left to right by clan and shuffle clan members
   915 if divide and (not sectionDivide) then
   909 if divide then
   916     SortHHsByClan();
   910     SortHHsByClan();
   917 end;
   911 end;
   918 
   912 
   919 
   913 
   920 {procedure AmmoFlameWork(Ammo: PGear);
   914 {procedure AmmoFlameWork(Ammo: PGear);