Use null propagation

This commit is contained in:
Gustas
2023-02-19 15:29:08 +02:00
committed by Pavel Penev
parent b06cbd7a95
commit 157d1b32dc
12 changed files with 30 additions and 36 deletions

View File

@@ -74,8 +74,7 @@ namespace OpenRA.Mods.Common.Traits
self.World.Add(playerBeacon);
if (self.Owner.IsAlliedWith(self.World.RenderPlayer))
Game.Sound.PlayNotification(self.World.Map.Rules, null, info.NotificationType, info.Notification,
self.World.RenderPlayer != null ? self.World.RenderPlayer.Faction.InternalName : null);
Game.Sound.PlayNotification(self.World.Map.Rules, null, info.NotificationType, info.Notification, self.World.RenderPlayer?.Faction.InternalName);
if (radarPings != null)
{

View File

@@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Traits
{
if (!world.IsLoadingGameSave)
{
Game.Sound.PlayNotification(world.Map.Rules, null, "Speech", info.Notification, world.RenderPlayer == null ? null : world.RenderPlayer.Faction.InternalName);
Game.Sound.PlayNotification(world.Map.Rules, null, "Speech", info.Notification, world.RenderPlayer?.Faction.InternalName);
TextNotificationsManager.AddTransientLine(info.TextNotification, null);
}
}
@@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Traits
{
if (!world.IsReplay)
{
Game.Sound.PlayNotification(world.Map.Rules, null, "Speech", info.LoadedNotification, world.RenderPlayer == null ? null : world.RenderPlayer.Faction.InternalName);
Game.Sound.PlayNotification(world.Map.Rules, null, "Speech", info.LoadedNotification, world.RenderPlayer?.Faction.InternalName);
TextNotificationsManager.AddTransientLine(info.LoadedTextNotification, null);
}
}
@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Traits
{
if (!world.IsReplay)
{
Game.Sound.PlayNotification(world.Map.Rules, null, "Speech", info.SavedNotification, world.RenderPlayer == null ? null : world.RenderPlayer.Faction.InternalName);
Game.Sound.PlayNotification(world.Map.Rules, null, "Speech", info.SavedNotification, world.RenderPlayer?.Faction.InternalName);
TextNotificationsManager.AddTransientLine(info.SavedTextNotification, null);
}
}