hedgewars/uTeams.pas
changeset 2703 fbde0d971ba6
parent 2699 249adefa9c1c
child 2704 51cda17b7c3b
--- a/hedgewars/uTeams.pas	Sat Jan 23 21:57:24 2010 +0000
+++ b/hedgewars/uTeams.pas	Sun Jan 24 07:26:03 2010 +0000
@@ -309,7 +309,18 @@
 procedure InitTeams;
 var i, t: LongInt;
     th: LongInt;
+    cp: PClan;
 begin
+if (GameFlags and gfRandomOrder) <> 0 then  // shuffle them up a bit
+   for i:= 0 to ClansCount * 8 do
+      begin
+      t:= GetRandom(Pred(ClansCount))+1;
+      cp:= ClansArray[0];
+      ClansArray[0]:= ClansArray[t];
+      ClansArray[t]:= cp;
+      ClansArray[t]^.ClanIndex:= t;
+      ClansArray[0]^.ClanIndex:= 0;
+      end;
 for t:= 0 to Pred(TeamsCount) do
    with TeamsArray[t]^ do
       begin