Fix IDE0120
This commit is contained in:
committed by
Pavel Penev
parent
ede5412526
commit
bf960b6eae
@@ -210,6 +210,9 @@ dotnet_diagnostic.IDE0082.severity = warning
|
|||||||
# Remove unnecessary equality operator.
|
# Remove unnecessary equality operator.
|
||||||
dotnet_diagnostic.IDE0100.severity = warning
|
dotnet_diagnostic.IDE0100.severity = warning
|
||||||
|
|
||||||
|
# Simplify LINQ expression.
|
||||||
|
dotnet_diagnostic.IDE0120.severity = warning
|
||||||
|
|
||||||
# Naming rule violation.
|
# Naming rule violation.
|
||||||
dotnet_diagnostic.IDE1006.severity = warning
|
dotnet_diagnostic.IDE1006.severity = warning
|
||||||
|
|
||||||
|
|||||||
@@ -748,7 +748,7 @@ namespace OpenRA
|
|||||||
public byte[] SavePreview()
|
public byte[] SavePreview()
|
||||||
{
|
{
|
||||||
var actorTypes = Rules.Actors.Values.Where(a => a.HasTraitInfo<IMapPreviewSignatureInfo>());
|
var actorTypes = Rules.Actors.Values.Where(a => a.HasTraitInfo<IMapPreviewSignatureInfo>());
|
||||||
var actors = ActorDefinitions.Where(a => actorTypes.Where(ai => ai.Name == a.Value.Value).Any());
|
var actors = ActorDefinitions.Where(a => actorTypes.Any(ai => ai.Name == a.Value.Value));
|
||||||
var positions = new List<(MPos Position, Color Color)>();
|
var positions = new List<(MPos Position, Color Color)>();
|
||||||
foreach (var actor in actors)
|
foreach (var actor in actors)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
|
|
||||||
public virtual void RulesetLoaded(Ruleset rules, ActorInfo ai)
|
public virtual void RulesetLoaded(Ruleset rules, ActorInfo ai)
|
||||||
{
|
{
|
||||||
if (rules.Actors[SystemActors.Player].TraitInfos<ProductionIconOverlayManagerInfo>().Where(piom => piom != this && piom.Type == Type).Any())
|
if (rules.Actors[SystemActors.Player].TraitInfos<ProductionIconOverlayManagerInfo>().Any(piom => piom != this && piom.Type == Type))
|
||||||
throw new YamlException($"Multiple 'ProductionIconOverlayManager's with type '{Type}' exist.");
|
throw new YamlException($"Multiple 'ProductionIconOverlayManager's with type '{Type}' exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,10 +27,10 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
{
|
{
|
||||||
foreach (var type in Types)
|
foreach (var type in Types)
|
||||||
{
|
{
|
||||||
if (!rules.Actors[SystemActors.Player].TraitInfos<ProductionIconOverlayManagerInfo>().Where(piom => piom.Type == type).Any())
|
if (!rules.Actors[SystemActors.Player].TraitInfos<ProductionIconOverlayManagerInfo>().Any(piom => piom.Type == type))
|
||||||
throw new YamlException($"A 'ProductionIconOverlayManager' with type '{type}' doesn't exist.");
|
throw new YamlException($"A 'ProductionIconOverlayManager' with type '{type}' doesn't exist.");
|
||||||
|
|
||||||
if (ai.TraitInfos<WithProductionIconOverlayInfo>().Where(wpio => wpio != this && wpio.Types.Contains(type)).Any())
|
if (ai.TraitInfos<WithProductionIconOverlayInfo>().Any(wpio => wpio != this && wpio.Types.Contains(type)))
|
||||||
throw new YamlException($"Multiple 'WithProductionIconOverlay's with type '{type}' exist on the actor.");
|
throw new YamlException($"Multiple 'WithProductionIconOverlay's with type '{type}' exist on the actor.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user