813 |
813 |
814 procedure AssignHHCoords; |
814 procedure AssignHHCoords; |
815 var i, t, p, j: LongInt; |
815 var i, t, p, j: LongInt; |
816 ar: array[0..Pred(cMaxHHs)] of PHedgehog; |
816 ar: array[0..Pred(cMaxHHs)] of PHedgehog; |
817 Count: Longword; |
817 Count: Longword; |
818 divide: boolean; |
818 divide, sectionDivide: boolean; |
819 begin |
819 begin |
820 if (GameFlags and gfPlaceHog) <> 0 then |
820 if (GameFlags and gfPlaceHog) <> 0 then |
821 PlacingHogs:= true; |
821 PlacingHogs:= true; |
822 |
822 |
823 divide:= ((GameFlags and gfDivideTeams) <> 0); |
823 divide:= ((GameFlags and gfDivideTeams) <> 0); |
824 |
824 |
825 // in section-divide mode, divide the map into equal-width sections and put each clan in one of them |
825 (* sectionDivide will determine the mode of hog distribution |
826 if divide then |
826 * |
|
827 * On generated maps or maps not designed with divided mode in mind, |
|
828 * using spawning sections can be problematic, because some sections may |
|
829 * contain too little land surface for sensible spawning. |
|
830 * |
|
831 * if sectionDivide is true, the map will be sliced into equal-width sections |
|
832 * and one team spawned in each |
|
833 * if false, the hogs will be spawned normally and sorted by teams after |
|
834 * |
|
835 *) |
|
836 |
|
837 // TODO: there might be a smarter way to decide if dividing clans into equal-width map sections makes sense |
|
838 // e.g. by checking if there is enough spawn area in each section |
|
839 sectionDivide:= divide and ((cMapGen = mgForts) or (ClansCount = 2)); |
|
840 |
|
841 // divide the map into equal-width sections and put each clan in one of them |
|
842 if sectionDivide then |
827 begin |
843 begin |
828 t:= leftX; |
844 t:= leftX; |
829 for p:= 0 to (ClansCount - 1) do |
845 for p:= 0 to (ClansCount - 1) do |
830 begin |
846 begin |
831 with SpawnClansArray[p]^ do |
847 with SpawnClansArray[p]^ do |