Fix warnings and code cleanup/fixes (#13570)

This commit is contained in:
Visne
2023-01-19 03:56:45 +01:00
committed by GitHub
parent 3ca5a0224b
commit c6d3e4f3bd
265 changed files with 499 additions and 666 deletions

View File

@@ -100,7 +100,7 @@ namespace Content.Shared.Localizations
iargs[i - 2] = n;
}
if (!ut!.TryGetUnit(max, out var mu))
if (!ut.TryGetUnit(max, out var mu))
throw new ArgumentException("Unit out of range for type");
var fargs = new object[iargs.Length];

View File

@@ -1,4 +1,5 @@
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
namespace Content.Shared.Localizations
{
@@ -51,9 +52,9 @@ namespace Content.Shared.Localizations
public string Format(double val)
{
if (TryGetUnit(val, out var w))
return (val * w.Factor).ToString() + " " + Loc.GetString("units-" + w.Unit);
return (val * w.Factor) + " " + Loc.GetString("units-" + w.Unit);
return val.ToString();
return val.ToString(CultureInfo.InvariantCulture);
}
public string Format(double val, string fmt)
@@ -130,11 +131,11 @@ namespace Content.Shared.Localizations
public readonly static Dictionary<string, TypeTable> Types = new Dictionary<string, TypeTable>
{
["generic"] = Generic!,
["pressure"] = Pressure!,
["power"] = Power!,
["energy"] = Energy!,
["temperature"] = Temperature!
["generic"] = Generic,
["pressure"] = Pressure,
["power"] = Power,
["energy"] = Energy,
["temperature"] = Temperature,
};
}
}