diff --git a/OpenRA.Game/Map/Map.cs b/OpenRA.Game/Map/Map.cs index 33518de4ff..c873bf9502 100644 --- a/OpenRA.Game/Map/Map.cs +++ b/OpenRA.Game/Map/Map.cs @@ -858,10 +858,10 @@ namespace OpenRA ProjectedCellBounds = new ProjectedCellRegion(this, tl, br); } - public void FixOpenAreas(Ruleset rules) + public void FixOpenAreas() { var r = new Random(); - var tileset = rules.TileSets[Tileset]; + var tileset = Rules.TileSets[Tileset]; for (var j = Bounds.Top; j < Bounds.Bottom; j++) { diff --git a/OpenRA.Mods.Common/UtilityCommands/ImportLegacyMapCommand.cs b/OpenRA.Mods.Common/UtilityCommands/ImportLegacyMapCommand.cs index 099583d101..4ac7bb7dc0 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ImportLegacyMapCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ImportLegacyMapCommand.cs @@ -33,7 +33,6 @@ namespace OpenRA.Mods.Common.UtilityCommands public ModData ModData; public Map Map; - public Ruleset Rules; public List Players = new List(); public MapPlayers MapPlayers; @@ -49,7 +48,6 @@ namespace OpenRA.Mods.Common.UtilityCommands // HACK: The engine code assumes that Game.modData is set. Game.ModData = modData; - Rules = modData.RulesetCache.Load(modData.DefaultFileSystem); var filename = args[1]; using (var stream = modData.DefaultFileSystem.Open(filename)) @@ -62,7 +60,7 @@ namespace OpenRA.Mods.Common.UtilityCommands ValidateMapFormat(format); var tileset = GetTileset(mapSection); - Map = new Map(modData, Rules.TileSets[tileset], MapSize, MapSize) + Map = new Map(modData, modData.DefaultRules.TileSets[tileset], MapSize, MapSize) { Title = basic.GetValue("Name", Path.GetFileNameWithoutExtension(filename)), Author = "Westwood Studios" @@ -93,7 +91,7 @@ namespace OpenRA.Mods.Common.UtilityCommands Map.PlayerDefinitions = MapPlayers.ToMiniYaml(); } - Map.FixOpenAreas(Rules); + Map.FixOpenAreas(); var dest = Path.GetFileNameWithoutExtension(args[1]) + ".oramap"; var package = new ZipFile(modData.ModFiles, dest, true); @@ -180,9 +178,9 @@ namespace OpenRA.Mods.Common.UtilityCommands public virtual void ReadActors(IniFile file) { - LoadActors(file, "STRUCTURES", Players, MapSize, Rules, Map); - LoadActors(file, "UNITS", Players, MapSize, Rules, Map); - LoadActors(file, "INFANTRY", Players, MapSize, Rules, Map); + LoadActors(file, "STRUCTURES", Players, MapSize, Map); + LoadActors(file, "UNITS", Players, MapSize, Map); + LoadActors(file, "INFANTRY", Players, MapSize, Map); } public abstract void LoadPlayer(IniFile file, string section); @@ -298,7 +296,7 @@ namespace OpenRA.Mods.Common.UtilityCommands mapPlayers.Players[section] = pr; } - public static void LoadActors(IniFile file, string section, List players, int mapSize, Ruleset rules, Map map) + public static void LoadActors(IniFile file, string section, List players, int mapSize, Map map) { foreach (var s in file.GetSection(section, true)) { @@ -334,7 +332,7 @@ namespace OpenRA.Mods.Common.UtilityCommands var actorCount = map.ActorDefinitions.Count; - if (!rules.Actors.ContainsKey(parts[1].ToLowerInvariant())) + if (!map.Rules.Actors.ContainsKey(parts[1].ToLowerInvariant())) Console.WriteLine("Ignoring unknown actor type: `{0}`".F(parts[1].ToLowerInvariant())); else map.ActorDefinitions.Add(new MiniYamlNode("Actor" + actorCount++, actor.Save())); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/NewMapLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/NewMapLogic.cs index 53b4241590..45fe326b1e 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/NewMapLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/NewMapLogic.cs @@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic map.SetBounds(tl, br); map.PlayerDefinitions = new MapPlayers(map.Rules, map.SpawnPoints.Value.Length).ToMiniYaml(); - map.FixOpenAreas(world.Map.Rules); + map.FixOpenAreas(); Action afterSave = uid => { diff --git a/OpenRA.Mods.RA/ImportRedAlertLegacyMapCommand.cs b/OpenRA.Mods.RA/ImportRedAlertLegacyMapCommand.cs index 77b09d7ead..ed3b5840a2 100644 --- a/OpenRA.Mods.RA/ImportRedAlertLegacyMapCommand.cs +++ b/OpenRA.Mods.RA/ImportRedAlertLegacyMapCommand.cs @@ -226,7 +226,7 @@ namespace OpenRA.Mods.RA.UtilityCommands public override void ReadActors(IniFile file) { base.ReadActors(file); - LoadActors(file, "SHIPS", Players, MapSize, Rules, Map); + LoadActors(file, "SHIPS", Players, MapSize, Map); } } }