From e0628b5f24781ba603e36c01b0fda9f1a115ac26 Mon Sep 17 00:00:00 2001 From: Pavlos Touboulidis Date: Sun, 11 May 2014 03:27:03 +0300 Subject: [PATCH] Change IngameChatLogic & MusicPlayerLogic to use the mod's rules, not the map's --- OpenRA.Mods.RA/Widgets/Logic/IngameChatLogic.cs | 8 ++++---- OpenRA.Mods.RA/Widgets/Logic/MusicPlayerLogic.cs | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/OpenRA.Mods.RA/Widgets/Logic/IngameChatLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/IngameChatLogic.cs index 9b882db821..70b855acff 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/IngameChatLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/IngameChatLogic.cs @@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic { public class IngameChatLogic { - readonly World world; + readonly Ruleset modRules; readonly ContainerWidget chatOverlay; readonly ChatDisplayWidget chatOverlayDisplay; @@ -35,9 +35,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic bool teamChat; [ObjectCreator.UseCtor] - public IngameChatLogic(Widget widget, OrderManager orderManager, World world) + public IngameChatLogic(Widget widget, OrderManager orderManager, World world, Ruleset modRules) { - this.world = world; + this.modRules = modRules; chatTraits = world.WorldActor.TraitsImplementing().ToList(); @@ -165,7 +165,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic if (scrolledToBottom) chatScrollPanel.ScrollToBottom(); - Sound.PlayNotification(world.Map.Rules, null, "Sounds", "ChatLine", null); + Sound.PlayNotification(modRules, null, "Sounds", "ChatLine", null); } } } \ No newline at end of file diff --git a/OpenRA.Mods.RA/Widgets/Logic/MusicPlayerLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/MusicPlayerLogic.cs index ea92dff627..c26b4f0c8f 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/MusicPlayerLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/MusicPlayerLogic.cs @@ -18,7 +18,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic { public class MusicPlayerLogic { - readonly World world; + readonly Ruleset modRules; bool installed; MusicInfo currentSong = null; @@ -29,9 +29,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic ScrollItemWidget itemTemplate; [ObjectCreator.UseCtor] - public MusicPlayerLogic(Widget widget, World world, Action onExit) + public MusicPlayerLogic(Widget widget, Ruleset modRules, Action onExit) { - this.world = world; + this.modRules = modRules; var panel = widget.Get("MUSIC_PANEL"); @@ -86,7 +86,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic public void BuildMusicTable() { - music = world.Map.Rules.InstalledMusic.Select(a => a.Value).ToArray(); + music = modRules.InstalledMusic.Select(a => a.Value).ToArray(); random = music.Shuffle(Game.CosmeticRandom).ToArray(); currentSong = Sound.CurrentMusic; if (currentSong == null && music.Any()) @@ -109,7 +109,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic if (currentSong != null) musicList.ScrollToItem(currentSong.Filename); - installed = world.Map.Rules.InstalledMusic.Any(); + installed = modRules.InstalledMusic.Any(); } void Play()