Remove direct access to MapPreview.Rules.

This commit is contained in:
Paul Chote
2021-04-04 16:40:46 +01:00
committed by teinarss
parent 53e6d974f0
commit abee274f88
22 changed files with 57 additions and 54 deletions

View File

@@ -28,9 +28,8 @@ namespace OpenRA.Mods.Common.Traits
/// </summary>
void ICreatePlayersInfo.CreateServerPlayers(MapPreview map, Session lobbyInfo, List<GameInformation.Player> players, MersenneTwister playerRandom)
{
var worldInfo = map.Rules.Actors[SystemActors.World];
var factions = worldInfo.TraitInfos<FactionInfo>().ToArray();
var assignSpawnLocations = worldInfo.TraitInfoOrDefault<IAssignSpawnPointsInfo>();
var factions = map.WorldActorInfo.TraitInfos<FactionInfo>().ToArray();
var assignSpawnLocations = map.WorldActorInfo.TraitInfoOrDefault<IAssignSpawnPointsInfo>();
var spawnState = assignSpawnLocations?.InitializeState(map, lobbyInfo);
// Create the unplayable map players -- neutral, shellmap, scripted, etc.
@@ -42,7 +41,7 @@ namespace OpenRA.Mods.Common.Traits
}
// Create the regular playable players.
var bots = map.Rules.Actors[SystemActors.Player].TraitInfos<IBotInfo>().ToArray();
var bots = map.PlayerActorInfo.TraitInfos<IBotInfo>().ToArray();
foreach (var kv in lobbyInfo.Slots)
{