Fix map-specific factions remaining selected when changing map.

This commit is contained in:
Paul Chote
2020-04-15 14:21:09 +01:00
committed by abcdefg30
parent 429dbe3e0c
commit 33f3038316

View File

@@ -398,8 +398,17 @@ namespace OpenRA.Mods.Common.Server
LoadMapSettings(server, server.LobbyInfo.GlobalSettings, server.Map.Rules);
// Reset client states
var selectableFactions = server.Map.Rules.Actors["world"].TraitInfos<FactionInfo>()
.Where(f => f.Selectable)
.Select(f => f.InternalName)
.ToList();
foreach (var c in server.LobbyInfo.Clients)
{
c.State = Session.ClientState.Invalid;
if (!selectableFactions.Contains(c.Faction))
c.Faction = "Random";
}
// Reassign players into new slots based on their old slots:
// - Observers remain as observers