Interesting idea.This can produce a mess out of map. Like 2x2 units locked in small rooms and so on.
I can update code that both terrorist ranks would stay in place (I supposed that 2x2 is used for terrorist 2)
The code actually shuffle only ranks and reset priorities - so the unit size and movement limitations stay as it is
So theoretically ( if terrorist 1 is 2x2 unit and allowed nodes for this ran are small units only) map script does not spawn unit or report error
However only one surface 2x2 units are terrorist , so I will add Binary that omits both terrorist ranks
Algorithm:
for (int i = 0; i<fileLenght / 24; i++)
{
fs_Rmp.Read(buffer, 0, 24); // 20 - unit rank,21-patrol priority, 23-spawn priority (others like links, position, unit size are unaffected)
RouteNode r = new RouteNode(buffer);
r.SpawnPriority = 1;
r.PatrolPriority = 1;
ranks[r.Rank]++;
if (r.Rank != 1 && r.Rank !=
// not X-XCOM and terrorist
toMixNodeIndexes.Add(i);
routeNodes.Add(r);
}
// randomization
while (toMixNodeIndexes.Count > 0)
{
int idx = RandVal(toMixNodeIndexes.Count);
mixedNodeIndexes.Add(toMixNodeIndexes[idx]);
toMixNodeIndexes.RemoveAt(idx);
}
ranks[1] = 0;
int convertedNodes = 0;
for (byte i = 0; i < 8; i++)
{
for (byte j = 0; j < ranks
; j++)
{
routeNodes[mixedNodeIndexes[convertedNodes]].Rank = i;
convertedNodes++;
}
}