summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/StateTracking
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-04-06 18:24:59 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-04-06 18:24:59 -0400
commita593eda30f82af474887d91458b0e9158f66fefc (patch)
tree8aa0e0586e3cce7627e8c4ff445a953665953f8f /src/SMAPI/Framework/StateTracking
parent29f909a8d5dbb83d6df1a54d2680e6f9898f3b19 (diff)
downloadSMAPI-a593eda30f82af474887d91458b0e9158f66fefc.tar.gz
SMAPI-a593eda30f82af474887d91458b0e9158f66fefc.tar.bz2
SMAPI-a593eda30f82af474887d91458b0e9158f66fefc.zip
use target-typed new
Diffstat (limited to 'src/SMAPI/Framework/StateTracking')
-rw-r--r--src/SMAPI/Framework/StateTracking/ChestTracker.cs4
-rw-r--r--src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableListWatcher.cs4
-rw-r--r--src/SMAPI/Framework/StateTracking/FieldWatchers/ImmutableCollectionWatcher.cs2
-rw-r--r--src/SMAPI/Framework/StateTracking/FieldWatchers/NetCollectionWatcher.cs4
-rw-r--r--src/SMAPI/Framework/StateTracking/FieldWatchers/ObservableCollectionWatcher.cs6
-rw-r--r--src/SMAPI/Framework/StateTracking/LocationTracker.cs2
-rw-r--r--src/SMAPI/Framework/StateTracking/PlayerTracker.cs2
-rw-r--r--src/SMAPI/Framework/StateTracking/Snapshots/LocationSnapshot.cs14
-rw-r--r--src/SMAPI/Framework/StateTracking/Snapshots/PlayerSnapshot.cs4
-rw-r--r--src/SMAPI/Framework/StateTracking/Snapshots/WatcherSnapshot.cs16
-rw-r--r--src/SMAPI/Framework/StateTracking/Snapshots/WorldLocationsSnapshot.cs4
11 files changed, 31 insertions, 31 deletions
diff --git a/src/SMAPI/Framework/StateTracking/ChestTracker.cs b/src/SMAPI/Framework/StateTracking/ChestTracker.cs
index 65f58ee7..56aeeb3c 100644
--- a/src/SMAPI/Framework/StateTracking/ChestTracker.cs
+++ b/src/SMAPI/Framework/StateTracking/ChestTracker.cs
@@ -18,10 +18,10 @@ namespace StardewModdingAPI.Framework.StateTracking
private readonly IDictionary<Item, int> StackSizes;
/// <summary>Items added since the last update.</summary>
- private readonly HashSet<Item> Added = new HashSet<Item>(new ObjectReferenceComparer<Item>());
+ private readonly HashSet<Item> Added = new(new ObjectReferenceComparer<Item>());
/// <summary>Items removed since the last update.</summary>
- private readonly HashSet<Item> Removed = new HashSet<Item>(new ObjectReferenceComparer<Item>());
+ private readonly HashSet<Item> Removed = new(new ObjectReferenceComparer<Item>());
/// <summary>The underlying inventory watcher.</summary>
private readonly ICollectionWatcher<Item> InventoryWatcher;
diff --git a/src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableListWatcher.cs b/src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableListWatcher.cs
index 32ec8c7e..256370ce 100644
--- a/src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableListWatcher.cs
+++ b/src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableListWatcher.cs
@@ -17,10 +17,10 @@ namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers
private HashSet<TValue> LastValues;
/// <summary>The pairs added since the last reset.</summary>
- private readonly List<TValue> AddedImpl = new List<TValue>();
+ private readonly List<TValue> AddedImpl = new();
/// <summary>The pairs removed since the last reset.</summary>
- private readonly List<TValue> RemovedImpl = new List<TValue>();
+ private readonly List<TValue> RemovedImpl = new();
/*********
diff --git a/src/SMAPI/Framework/StateTracking/FieldWatchers/ImmutableCollectionWatcher.cs b/src/SMAPI/Framework/StateTracking/FieldWatchers/ImmutableCollectionWatcher.cs
index 009e0282..84340fbf 100644
--- a/src/SMAPI/Framework/StateTracking/FieldWatchers/ImmutableCollectionWatcher.cs
+++ b/src/SMAPI/Framework/StateTracking/FieldWatchers/ImmutableCollectionWatcher.cs
@@ -11,7 +11,7 @@ namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers
** Accessors
*********/
/// <summary>A singleton collection watcher instance.</summary>
- public static ImmutableCollectionWatcher<TValue> Instance { get; } = new ImmutableCollectionWatcher<TValue>();
+ public static ImmutableCollectionWatcher<TValue> Instance { get; } = new();
/// <summary>Whether the collection changed since the last reset.</summary>
public bool IsChanged { get; } = false;
diff --git a/src/SMAPI/Framework/StateTracking/FieldWatchers/NetCollectionWatcher.cs b/src/SMAPI/Framework/StateTracking/FieldWatchers/NetCollectionWatcher.cs
index 21e84c47..676c9fb4 100644
--- a/src/SMAPI/Framework/StateTracking/FieldWatchers/NetCollectionWatcher.cs
+++ b/src/SMAPI/Framework/StateTracking/FieldWatchers/NetCollectionWatcher.cs
@@ -15,10 +15,10 @@ namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers
private readonly NetCollection<TValue> Field;
/// <summary>The pairs added since the last reset.</summary>
- private readonly List<TValue> AddedImpl = new List<TValue>();
+ private readonly List<TValue> AddedImpl = new();
/// <summary>The pairs removed since the last reset.</summary>
- private readonly List<TValue> RemovedImpl = new List<TValue>();
+ private readonly List<TValue> RemovedImpl = new();
/*********
diff --git a/src/SMAPI/Framework/StateTracking/FieldWatchers/ObservableCollectionWatcher.cs b/src/SMAPI/Framework/StateTracking/FieldWatchers/ObservableCollectionWatcher.cs
index c29d2783..3e9fa8b1 100644
--- a/src/SMAPI/Framework/StateTracking/FieldWatchers/ObservableCollectionWatcher.cs
+++ b/src/SMAPI/Framework/StateTracking/FieldWatchers/ObservableCollectionWatcher.cs
@@ -16,13 +16,13 @@ namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers
private readonly ObservableCollection<TValue> Field;
/// <summary>The pairs added since the last reset.</summary>
- private readonly List<TValue> AddedImpl = new List<TValue>();
+ private readonly List<TValue> AddedImpl = new();
/// <summary>The pairs removed since the last reset.</summary>
- private readonly List<TValue> RemovedImpl = new List<TValue>();
+ private readonly List<TValue> RemovedImpl = new();
/// <summary>The previous values as of the last update.</summary>
- private readonly List<TValue> PreviousValues = new List<TValue>();
+ private readonly List<TValue> PreviousValues = new();
/*********
diff --git a/src/SMAPI/Framework/StateTracking/LocationTracker.cs b/src/SMAPI/Framework/StateTracking/LocationTracker.cs
index 748e4ecc..f86f86ee 100644
--- a/src/SMAPI/Framework/StateTracking/LocationTracker.cs
+++ b/src/SMAPI/Framework/StateTracking/LocationTracker.cs
@@ -19,7 +19,7 @@ namespace StardewModdingAPI.Framework.StateTracking
** Fields
*********/
/// <summary>The underlying watchers.</summary>
- private readonly List<IWatcher> Watchers = new List<IWatcher>();
+ private readonly List<IWatcher> Watchers = new();
/*********
diff --git a/src/SMAPI/Framework/StateTracking/PlayerTracker.cs b/src/SMAPI/Framework/StateTracking/PlayerTracker.cs
index cf49a7c1..3d470b5c 100644
--- a/src/SMAPI/Framework/StateTracking/PlayerTracker.cs
+++ b/src/SMAPI/Framework/StateTracking/PlayerTracker.cs
@@ -24,7 +24,7 @@ namespace StardewModdingAPI.Framework.StateTracking
private GameLocation LastValidLocation;
/// <summary>The underlying watchers.</summary>
- private readonly List<IWatcher> Watchers = new List<IWatcher>();
+ private readonly List<IWatcher> Watchers = new();
/*********
diff --git a/src/SMAPI/Framework/StateTracking/Snapshots/LocationSnapshot.cs b/src/SMAPI/Framework/StateTracking/Snapshots/LocationSnapshot.cs
index 6c9cc4f5..2563d10c 100644
--- a/src/SMAPI/Framework/StateTracking/Snapshots/LocationSnapshot.cs
+++ b/src/SMAPI/Framework/StateTracking/Snapshots/LocationSnapshot.cs
@@ -17,25 +17,25 @@ namespace StardewModdingAPI.Framework.StateTracking.Snapshots
public GameLocation Location { get; }
/// <summary>Tracks added or removed buildings.</summary>
- public SnapshotListDiff<Building> Buildings { get; } = new SnapshotListDiff<Building>();
+ public SnapshotListDiff<Building> Buildings { get; } = new();
/// <summary>Tracks added or removed debris.</summary>
- public SnapshotListDiff<Debris> Debris { get; } = new SnapshotListDiff<Debris>();
+ public SnapshotListDiff<Debris> Debris { get; } = new();
/// <summary>Tracks added or removed large terrain features.</summary>
- public SnapshotListDiff<LargeTerrainFeature> LargeTerrainFeatures { get; } = new SnapshotListDiff<LargeTerrainFeature>();
+ public SnapshotListDiff<LargeTerrainFeature> LargeTerrainFeatures { get; } = new();
/// <summary>Tracks added or removed NPCs.</summary>
- public SnapshotListDiff<NPC> Npcs { get; } = new SnapshotListDiff<NPC>();
+ public SnapshotListDiff<NPC> Npcs { get; } = new();
/// <summary>Tracks added or removed objects.</summary>
- public SnapshotListDiff<KeyValuePair<Vector2, Object>> Objects { get; } = new SnapshotListDiff<KeyValuePair<Vector2, Object>>();
+ public SnapshotListDiff<KeyValuePair<Vector2, Object>> Objects { get; } = new();
/// <summary>Tracks added or removed terrain features.</summary>
- public SnapshotListDiff<KeyValuePair<Vector2, TerrainFeature>> TerrainFeatures { get; } = new SnapshotListDiff<KeyValuePair<Vector2, TerrainFeature>>();
+ public SnapshotListDiff<KeyValuePair<Vector2, TerrainFeature>> TerrainFeatures { get; } = new();
/// <summary>Tracks added or removed furniture.</summary>
- public SnapshotListDiff<Furniture> Furniture { get; } = new SnapshotListDiff<Furniture>();
+ public SnapshotListDiff<Furniture> Furniture { get; } = new();
/// <summary>Tracks changed chest inventories.</summary>
public IDictionary<Chest, SnapshotItemListDiff> ChestItems { get; } = new Dictionary<Chest, SnapshotItemListDiff>();
diff --git a/src/SMAPI/Framework/StateTracking/Snapshots/PlayerSnapshot.cs b/src/SMAPI/Framework/StateTracking/Snapshots/PlayerSnapshot.cs
index 72f45a87..f3e42948 100644
--- a/src/SMAPI/Framework/StateTracking/Snapshots/PlayerSnapshot.cs
+++ b/src/SMAPI/Framework/StateTracking/Snapshots/PlayerSnapshot.cs
@@ -14,7 +14,7 @@ namespace StardewModdingAPI.Framework.StateTracking.Snapshots
** Fields
*********/
/// <summary>An empty item list diff.</summary>
- private readonly SnapshotItemListDiff EmptyItemListDiff = new SnapshotItemListDiff(Array.Empty<Item>(), Array.Empty<Item>(), Array.Empty<ItemStackSizeChange>());
+ private readonly SnapshotItemListDiff EmptyItemListDiff = new(Array.Empty<Item>(), Array.Empty<Item>(), Array.Empty<ItemStackSizeChange>());
/*********
@@ -24,7 +24,7 @@ namespace StardewModdingAPI.Framework.StateTracking.Snapshots
public Farmer Player { get; }
/// <summary>The player's current location.</summary>
- public SnapshotDiff<GameLocation> Location { get; } = new SnapshotDiff<GameLocation>();
+ public SnapshotDiff<GameLocation> Location { get; } = new();
/// <summary>Tracks changes to the player's skill levels.</summary>
public IDictionary<SkillType, SnapshotDiff<int>> Skills { get; } =
diff --git a/src/SMAPI/Framework/StateTracking/Snapshots/WatcherSnapshot.cs b/src/SMAPI/Framework/StateTracking/Snapshots/WatcherSnapshot.cs
index cf51e040..afea7fb4 100644
--- a/src/SMAPI/Framework/StateTracking/Snapshots/WatcherSnapshot.cs
+++ b/src/SMAPI/Framework/StateTracking/Snapshots/WatcherSnapshot.cs
@@ -11,31 +11,31 @@ namespace StardewModdingAPI.Framework.StateTracking.Snapshots
** Accessors
*********/
/// <summary>Tracks changes to the window size.</summary>
- public SnapshotDiff<Point> WindowSize { get; } = new SnapshotDiff<Point>();
+ public SnapshotDiff<Point> WindowSize { get; } = new();
/// <summary>Tracks changes to the current player.</summary>
public PlayerSnapshot CurrentPlayer { get; private set; }
/// <summary>Tracks changes to the time of day (in 24-hour military format).</summary>
- public SnapshotDiff<int> Time { get; } = new SnapshotDiff<int>();
+ public SnapshotDiff<int> Time { get; } = new();
/// <summary>Tracks changes to the save ID.</summary>
- public SnapshotDiff<ulong> SaveID { get; } = new SnapshotDiff<ulong>();
+ public SnapshotDiff<ulong> SaveID { get; } = new();
/// <summary>Tracks changes to the game's locations.</summary>
- public WorldLocationsSnapshot Locations { get; } = new WorldLocationsSnapshot();
+ public WorldLocationsSnapshot Locations { get; } = new();
/// <summary>Tracks changes to <see cref="Game1.activeClickableMenu"/>.</summary>
- public SnapshotDiff<IClickableMenu> ActiveMenu { get; } = new SnapshotDiff<IClickableMenu>();
+ public SnapshotDiff<IClickableMenu> ActiveMenu { get; } = new();
/// <summary>Tracks changes to the cursor position.</summary>
- public SnapshotDiff<ICursorPosition> Cursor { get; } = new SnapshotDiff<ICursorPosition>();
+ public SnapshotDiff<ICursorPosition> Cursor { get; } = new();
/// <summary>Tracks changes to the mouse wheel scroll.</summary>
- public SnapshotDiff<int> MouseWheelScroll { get; } = new SnapshotDiff<int>();
+ public SnapshotDiff<int> MouseWheelScroll { get; } = new();
/// <summary>Tracks changes to the content locale.</summary>
- public SnapshotDiff<LocalizedContentManager.LanguageCode> Locale { get; } = new SnapshotDiff<LocalizedContentManager.LanguageCode>();
+ public SnapshotDiff<LocalizedContentManager.LanguageCode> Locale { get; } = new();
/*********
diff --git a/src/SMAPI/Framework/StateTracking/Snapshots/WorldLocationsSnapshot.cs b/src/SMAPI/Framework/StateTracking/Snapshots/WorldLocationsSnapshot.cs
index 73ed2d8f..7dee09ca 100644
--- a/src/SMAPI/Framework/StateTracking/Snapshots/WorldLocationsSnapshot.cs
+++ b/src/SMAPI/Framework/StateTracking/Snapshots/WorldLocationsSnapshot.cs
@@ -12,14 +12,14 @@ namespace StardewModdingAPI.Framework.StateTracking.Snapshots
** Fields
*********/
/// <summary>A map of tracked locations.</summary>
- private readonly Dictionary<GameLocation, LocationSnapshot> LocationsDict = new Dictionary<GameLocation, LocationSnapshot>(new ObjectReferenceComparer<GameLocation>());
+ private readonly Dictionary<GameLocation, LocationSnapshot> LocationsDict = new(new ObjectReferenceComparer<GameLocation>());
/*********
** Accessors
*********/
/// <summary>Tracks changes to the location list.</summary>
- public SnapshotListDiff<GameLocation> LocationList { get; } = new SnapshotListDiff<GameLocation>();
+ public SnapshotListDiff<GameLocation> LocationList { get; } = new();
/// <summary>The tracked locations.</summary>
public IEnumerable<LocationSnapshot> Locations => this.LocationsDict.Values;