Fix RCS1257, RCS1258, RCS1261, RCS1262, RCS1265, RCS1266, RCS1267
This commit is contained in:
committed by
Gustas Kažukauskas
parent
a324af1afd
commit
1b2c119b58
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Commands
|
||||
{
|
||||
TextNotificationsManager.Debug(FluentProvider.GetMessage(AvailableCommands));
|
||||
|
||||
foreach (var key in console.Commands.Keys.OrderBy(k => k))
|
||||
foreach (var key in console.Commands.Keys.Order())
|
||||
{
|
||||
if (!helpDescriptions.TryGetValue(key, out var description))
|
||||
description = FluentProvider.GetMessage(NoDescription);
|
||||
|
||||
@@ -96,10 +96,10 @@ namespace OpenRA.Mods.Common.Effects
|
||||
{
|
||||
var palette = wr.Palette(rp.PaletteName);
|
||||
if (circles != null)
|
||||
renderables = renderables.Concat(circles.Render(targetLineNodes.Last(), palette));
|
||||
renderables = renderables.Concat(circles.Render(targetLineNodes[^1], palette));
|
||||
|
||||
if (flag != null)
|
||||
renderables = renderables.Concat(flag.Render(targetLineNodes.Last(), palette));
|
||||
renderables = renderables.Concat(flag.Render(targetLineNodes[^1], palette));
|
||||
}
|
||||
|
||||
return renderables;
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
// Scripted cargo aircraft must turn to default position before unloading.
|
||||
// TODO: pass facing through UnloadCargo instead.
|
||||
if (aircraft != null)
|
||||
transport.QueueActivity(new Land(transport, Target.FromCell(transport.World, entryPath.Last()), WDist.FromCells(dropRange)));
|
||||
transport.QueueActivity(new Land(transport, Target.FromCell(transport.World, entryPath[^1]), WDist.FromCells(dropRange)));
|
||||
|
||||
if (cargo != null)
|
||||
transport.QueueActivity(new UnloadCargo(transport, WDist.FromCells(dropRange)));
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
get
|
||||
{
|
||||
if (rp.Path.Count > 0)
|
||||
return rp.Path.Last();
|
||||
return rp.Path[^1];
|
||||
|
||||
var exit = Self.NearestExitOrDefault(Self.CenterPosition);
|
||||
if (exit != null)
|
||||
|
||||
@@ -331,11 +331,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public bool HasSpace(int weight) { return totalWeight + reservedWeight + weight <= Info.MaxWeight; }
|
||||
public bool IsEmpty() { return cargo.Count == 0; }
|
||||
|
||||
public Actor Peek() { return cargo.Last(); }
|
||||
public Actor Peek() { return cargo[^1]; }
|
||||
|
||||
public Actor Unload(Actor self, Actor passenger = null)
|
||||
{
|
||||
passenger ??= cargo.Last();
|
||||
passenger ??= cargo[^1];
|
||||
if (!cargo.Remove(passenger))
|
||||
throw new ArgumentException("Attempted to unload an actor that is not a passenger.");
|
||||
|
||||
|
||||
@@ -373,7 +373,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
});
|
||||
|
||||
if (path.Count > 0)
|
||||
return lookup[path.Last()];
|
||||
return lookup[path[^1]];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
static string MakeKey(string[] prerequisites)
|
||||
{
|
||||
return "condition_" + string.Join("_", prerequisites.OrderBy(a => a));
|
||||
return "condition_" + string.Join("_", prerequisites.Order());
|
||||
}
|
||||
|
||||
public void Register(Actor actor, GrantConditionOnPrerequisite u, string[] prerequisites)
|
||||
|
||||
@@ -477,7 +477,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
var types = typeWeights
|
||||
.Select(kv => kv.Key)
|
||||
.OrderBy(k => k)
|
||||
.Order()
|
||||
.ToArray();
|
||||
var weights = types
|
||||
.Select(type => typeWeights[type])
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
allCategories = allActors.SelectMany(ac => ac.Categories)
|
||||
.Distinct()
|
||||
.OrderBy(x => x)
|
||||
.Order()
|
||||
.ToArray();
|
||||
|
||||
foreach (var c in allCategories)
|
||||
@@ -149,7 +149,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
s => s.Contains(searchFilter, StringComparison.CurrentCultureIgnoreCase)))
|
||||
.SelectMany(t => t.Categories)
|
||||
.Distinct()
|
||||
.OrderBy(x => x));
|
||||
.Order());
|
||||
else
|
||||
FilteredCategories.AddRange(allCategories);
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
return;
|
||||
}
|
||||
|
||||
using (var fileStream = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.ReadWrite, 8192, true))
|
||||
await using (var fileStream = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.ReadWrite, 8192, true))
|
||||
{
|
||||
await response.ReadAsStreamWithProgress(fileStream, OnDownloadProgress, token);
|
||||
}
|
||||
@@ -205,7 +205,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var archiveValid = false;
|
||||
try
|
||||
{
|
||||
using (var stream = File.OpenRead(file))
|
||||
await using (var stream = File.OpenRead(file))
|
||||
{
|
||||
var archiveSHA1 = CryptoUtil.SHA1Hash(stream);
|
||||
Log.Write("install", "Downloaded SHA1: " + archiveSHA1);
|
||||
@@ -233,7 +233,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var extracted = new List<string>();
|
||||
try
|
||||
{
|
||||
using (var stream = File.OpenRead(file))
|
||||
await using (var stream = File.OpenRead(file))
|
||||
{
|
||||
var packageLoader = modData.ObjectCreator.CreateObject<IPackageLoader>($"{download.Type}Loader");
|
||||
|
||||
@@ -253,8 +253,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(targetPath));
|
||||
extracted.Add(targetPath);
|
||||
|
||||
using (var zz = package.GetStream(kv.Value))
|
||||
using (var f = File.Create(targetPath))
|
||||
await using (var zz = package.GetStream(kv.Value))
|
||||
await using (var f = File.Create(targetPath))
|
||||
await zz.CopyToAsync(f);
|
||||
}
|
||||
|
||||
|
||||
@@ -887,7 +887,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
if (orderManager.LobbyInfo.GlobalSettings.Dedicated)
|
||||
{
|
||||
var endpoint = CurrentServerSettings.Target.GetConnectEndPoints().First();
|
||||
secret = string.Concat(endpoint.Address, "|", endpoint.Port);
|
||||
secret = $"{endpoint.Address}|{endpoint.Port}";
|
||||
}
|
||||
|
||||
var state = skirmishMode ? DiscordState.InSkirmishLobby : DiscordState.InMultiplayerLobby;
|
||||
|
||||
Reference in New Issue
Block a user