Use TryGetValue instead of ContainsKey and a lookup for cached sounds

This commit is contained in:
abcdefg30
2022-05-18 14:16:35 +02:00
committed by atlimit8
parent ea04a7fec5
commit 660130653c

View File

@@ -401,9 +401,8 @@ namespace OpenRA
if (!string.IsNullOrEmpty(name) && (p == null || p == p.World.LocalPlayer))
{
if (currentNotifications.ContainsKey(name))
if (currentNotifications.TryGetValue(name, out var currentNotification))
{
var currentNotification = currentNotifications[name];
if (!currentNotification.Complete)
{
if (pool.AllowInterrupt)
@@ -412,9 +411,8 @@ namespace OpenRA
return false;
}
}
else if (currentSounds.ContainsKey(actorId))
else if (currentSounds.TryGetValue(actorId, out var currentSound))
{
var currentSound = currentSounds[actorId];
if (!currentSound.Complete)
{
if (pool.AllowInterrupt)