From c8cfb10ab189fd6a0d80f258357bd46b00a46358 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Sun, 17 Apr 2016 15:26:53 +0200 Subject: [PATCH] Reduce the usage of different ways to determine the new owner We don't need the LocalPlayer check if we only play the sound to the new owner, and captor.Owner == newOwner in this case. --- OpenRA.Mods.Common/Traits/Sound/CaptureNotification.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Sound/CaptureNotification.cs b/OpenRA.Mods.Common/Traits/Sound/CaptureNotification.cs index 109c6d649c..7e7574309f 100644 --- a/OpenRA.Mods.Common/Traits/Sound/CaptureNotification.cs +++ b/OpenRA.Mods.Common/Traits/Sound/CaptureNotification.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits.Sound public class CaptureNotification : INotifyCapture { - CaptureNotificationInfo info; + readonly CaptureNotificationInfo info; public CaptureNotification(CaptureNotificationInfo info) { this.info = info; @@ -31,11 +31,8 @@ namespace OpenRA.Mods.Common.Traits.Sound public void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner) { - if (captor.World.LocalPlayer != captor.Owner) - return; - var faction = info.NewOwnerVoice ? newOwner.Faction.InternalName : oldOwner.Faction.InternalName; - Game.Sound.PlayNotification(self.World.Map.Rules, captor.World.LocalPlayer, "Speech", info.Notification, faction); + Game.Sound.PlayNotification(self.World.Map.Rules, newOwner, "Speech", info.Notification, faction); } } }