Fix map-specific factions remaining selected when changing map.
This commit is contained in:
@@ -398,8 +398,17 @@ namespace OpenRA.Mods.Common.Server
|
|||||||
LoadMapSettings(server, server.LobbyInfo.GlobalSettings, server.Map.Rules);
|
LoadMapSettings(server, server.LobbyInfo.GlobalSettings, server.Map.Rules);
|
||||||
|
|
||||||
// Reset client states
|
// 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)
|
foreach (var c in server.LobbyInfo.Clients)
|
||||||
|
{
|
||||||
c.State = Session.ClientState.Invalid;
|
c.State = Session.ClientState.Invalid;
|
||||||
|
if (!selectableFactions.Contains(c.Faction))
|
||||||
|
c.Faction = "Random";
|
||||||
|
}
|
||||||
|
|
||||||
// Reassign players into new slots based on their old slots:
|
// Reassign players into new slots based on their old slots:
|
||||||
// - Observers remain as observers
|
// - Observers remain as observers
|
||||||
|
|||||||
Reference in New Issue
Block a user