private void ScrambleLoneWolves(List<PlayerModel> loneWolves, Dictionary<int,SquadRoster> squads, int whichTeam)
{
// Add lone wolves to empty squads
int key = 0;
int emptyId = 1;
SquadRoster home = null;
bool filling = false;
// Do Team 1 first
foreach (PlayerModel wolf in loneWolves) {
if (wolf.Team != whichTeam)
continue;
bool goback = true;
while (goback) {
if (!filling) {
// Need to find an empty squad
key = (wolf.Team * 1000) + emptyId;
while (squads.ContainsKey(key)) {
emptyId = emptyId + 1;
if (emptyId > (SQUAD_NAMES.Length - 1)) break;
key = (wolf.Team * 1000) + emptyId;
}
filling = true;
}
if (emptyId > (SQUAD_NAMES.Length - 1)) break;
if (filling) {
// Add wolf to the squad we are filling until full
key = (wolf.Team * 1000) + emptyId;
home = AddPlayerToSquadRoster(squads, wolf, key, emptyId, false);
if (home == null || !home.Roster.Contains(wolf)) {
// Full
filling = false;
continue;
} else {
// Next wolf
DebugScrambler("Lone wolf ^b" + wolf.FullName + "^n filled in empty squad " + wolf.Team + "/" + emptyId);
goback = false;
continue;
}
}
}
}
}