pull in project-slippi/Ishiiruka/commit/3a3267c2872c7a1dc198f3508a048d6c4c046bcf

This commit is contained in:
Nikhil Narayana 2022-05-30 00:43:46 -07:00
commit 859610e4f7

View file

@ -2315,10 +2315,15 @@ void CEXISlippi::prepareOnlineMatchState()
areAllSameTeam = false;
}
// Randomize assignments to randomize teams when all same color
std::vector<u8> teamAssignments = {0, 0, 1, 1};
generator.seed(rngOffset);
std::shuffle(teamAssignments.begin(), teamAssignments.end(), generator);
// Choose random team assignments
// Previously there was a bug here where the shuffle was not consistent across platforms given
// the same seed, this would cause desyncs during cross platform play (different teams). Got
// around this by no longer using the shuffle function...
std::vector<std::vector<u8>> teamAssignmentPermutations = {
{0, 0, 1, 1}, {1, 1, 0, 0}, {0, 1, 1, 0}, {1, 0, 0, 1}, {0, 1, 0, 1}, {1, 0, 1, 0},
};
auto teamAssignments =
teamAssignmentPermutations[rngOffset % teamAssignmentPermutations.size()];
// Overwrite player character choices
for (auto& s : orderedSelections)