Changes for prototype load parallelization (#13066)

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
Pieter-Jan Briers
2022-12-20 23:25:34 +01:00
committed by GitHub
parent 584921b423
commit a323671984
50 changed files with 169 additions and 249 deletions

View File

@@ -81,7 +81,8 @@ namespace Content.Shared.Alert
if (idx == -1 && idy == -1)
{
// break ties by type value
return x.AlertType - y.AlertType;
// Must cast to int to avoid integer overflow when subtracting (enum's unsigned)
return (int)x.AlertType - (int)y.AlertType;
}
if (idx == -1) return 1;
@@ -92,7 +93,8 @@ namespace Content.Shared.Alert
if (result == 0)
{
// break ties by type value
return x.AlertType - y.AlertType;
// Must cast to int to avoid integer overflow when subtracting (enum's unsigned)
return (int)x.AlertType - (int)y.AlertType;
}
return result;

View File

@@ -1,4 +1,3 @@
using System.Globalization;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
@@ -11,9 +10,6 @@ namespace Content.Shared.Alert
[Prototype("alert")]
public sealed class AlertPrototype : IPrototype, ISerializationHooks
{
private FormattedMessage _name = new ();
private FormattedMessage _description = new ();
[ViewVariables]
string IPrototype.ID => AlertType.ToString();
@@ -34,21 +30,13 @@ namespace Content.Shared.Alert
/// Name to show in tooltip window. Accepts formatting.
/// </summary>
[DataField("name")]
public FormattedMessage Name
{
get => _name;
private set => _name = FormattedMessage.FromMarkup(Loc.GetString(value.ToString()));
}
public string Name { get; private set; } = "";
/// <summary>
/// Description to show in tooltip window. Accepts formatting.
/// </summary>
[DataField("description")]
public FormattedMessage Description
{
get => _description;
private set => _description = FormattedMessage.FromMarkup(Loc.GetString(value.ToString()));
}
public string Description { get; private set; } = "";
/// <summary>
/// Category the alert belongs to. Only one alert of a given category