From a593eda30f82af474887d91458b0e9158f66fefc Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 6 Apr 2022 18:24:59 -0400 Subject: use target-typed new --- src/SMAPI/Framework/StateTracking/ChestTracker.cs | 4 ++-- .../StateTracking/FieldWatchers/ComparableListWatcher.cs | 4 ++-- .../FieldWatchers/ImmutableCollectionWatcher.cs | 2 +- .../StateTracking/FieldWatchers/NetCollectionWatcher.cs | 4 ++-- .../FieldWatchers/ObservableCollectionWatcher.cs | 6 +++--- src/SMAPI/Framework/StateTracking/LocationTracker.cs | 2 +- src/SMAPI/Framework/StateTracking/PlayerTracker.cs | 2 +- .../StateTracking/Snapshots/LocationSnapshot.cs | 14 +++++++------- .../Framework/StateTracking/Snapshots/PlayerSnapshot.cs | 4 ++-- .../Framework/StateTracking/Snapshots/WatcherSnapshot.cs | 16 ++++++++-------- .../StateTracking/Snapshots/WorldLocationsSnapshot.cs | 4 ++-- 11 files changed, 31 insertions(+), 31 deletions(-) (limited to 'src/SMAPI/Framework/StateTracking') 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 StackSizes; /// Items added since the last update. - private readonly HashSet Added = new HashSet(new ObjectReferenceComparer()); + private readonly HashSet Added = new(new ObjectReferenceComparer()); /// Items removed since the last update. - private readonly HashSet Removed = new HashSet(new ObjectReferenceComparer()); + private readonly HashSet Removed = new(new ObjectReferenceComparer()); /// The underlying inventory watcher. private readonly ICollectionWatcher 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 LastValues; /// The pairs added since the last reset. - private readonly List AddedImpl = new List(); + private readonly List AddedImpl = new(); /// The pairs removed since the last reset. - private readonly List RemovedImpl = new List(); + private readonly List 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 *********/ /// A singleton collection watcher instance. - public static ImmutableCollectionWatcher Instance { get; } = new ImmutableCollectionWatcher(); + public static ImmutableCollectionWatcher Instance { get; } = new(); /// Whether the collection changed since the last reset. 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 Field; /// The pairs added since the last reset. - private readonly List AddedImpl = new List(); + private readonly List AddedImpl = new(); /// The pairs removed since the last reset. - private readonly List RemovedImpl = new List(); + private readonly List 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 Field; /// The pairs added since the last reset. - private readonly List AddedImpl = new List(); + private readonly List AddedImpl = new(); /// The pairs removed since the last reset. - private readonly List RemovedImpl = new List(); + private readonly List RemovedImpl = new(); /// The previous values as of the last update. - private readonly List PreviousValues = new List(); + private readonly List 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 *********/ /// The underlying watchers. - private readonly List Watchers = new List(); + private readonly List 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; /// The underlying watchers. - private readonly List Watchers = new List(); + private readonly List 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; } /// Tracks added or removed buildings. - public SnapshotListDiff Buildings { get; } = new SnapshotListDiff(); + public SnapshotListDiff Buildings { get; } = new(); /// Tracks added or removed debris. - public SnapshotListDiff Debris { get; } = new SnapshotListDiff(); + public SnapshotListDiff Debris { get; } = new(); /// Tracks added or removed large terrain features. - public SnapshotListDiff LargeTerrainFeatures { get; } = new SnapshotListDiff(); + public SnapshotListDiff LargeTerrainFeatures { get; } = new(); /// Tracks added or removed NPCs. - public SnapshotListDiff Npcs { get; } = new SnapshotListDiff(); + public SnapshotListDiff Npcs { get; } = new(); /// Tracks added or removed objects. - public SnapshotListDiff> Objects { get; } = new SnapshotListDiff>(); + public SnapshotListDiff> Objects { get; } = new(); /// Tracks added or removed terrain features. - public SnapshotListDiff> TerrainFeatures { get; } = new SnapshotListDiff>(); + public SnapshotListDiff> TerrainFeatures { get; } = new(); /// Tracks added or removed furniture. - public SnapshotListDiff Furniture { get; } = new SnapshotListDiff(); + public SnapshotListDiff Furniture { get; } = new(); /// Tracks changed chest inventories. public IDictionary ChestItems { get; } = new Dictionary(); 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 *********/ /// An empty item list diff. - private readonly SnapshotItemListDiff EmptyItemListDiff = new SnapshotItemListDiff(Array.Empty(), Array.Empty(), Array.Empty()); + private readonly SnapshotItemListDiff EmptyItemListDiff = new(Array.Empty(), Array.Empty(), Array.Empty()); /********* @@ -24,7 +24,7 @@ namespace StardewModdingAPI.Framework.StateTracking.Snapshots public Farmer Player { get; } /// The player's current location. - public SnapshotDiff Location { get; } = new SnapshotDiff(); + public SnapshotDiff Location { get; } = new(); /// Tracks changes to the player's skill levels. public IDictionary> 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 *********/ /// Tracks changes to the window size. - public SnapshotDiff WindowSize { get; } = new SnapshotDiff(); + public SnapshotDiff WindowSize { get; } = new(); /// Tracks changes to the current player. public PlayerSnapshot CurrentPlayer { get; private set; } /// Tracks changes to the time of day (in 24-hour military format). - public SnapshotDiff Time { get; } = new SnapshotDiff(); + public SnapshotDiff Time { get; } = new(); /// Tracks changes to the save ID. - public SnapshotDiff SaveID { get; } = new SnapshotDiff(); + public SnapshotDiff SaveID { get; } = new(); /// Tracks changes to the game's locations. - public WorldLocationsSnapshot Locations { get; } = new WorldLocationsSnapshot(); + public WorldLocationsSnapshot Locations { get; } = new(); /// Tracks changes to . - public SnapshotDiff ActiveMenu { get; } = new SnapshotDiff(); + public SnapshotDiff ActiveMenu { get; } = new(); /// Tracks changes to the cursor position. - public SnapshotDiff Cursor { get; } = new SnapshotDiff(); + public SnapshotDiff Cursor { get; } = new(); /// Tracks changes to the mouse wheel scroll. - public SnapshotDiff MouseWheelScroll { get; } = new SnapshotDiff(); + public SnapshotDiff MouseWheelScroll { get; } = new(); /// Tracks changes to the content locale. - public SnapshotDiff Locale { get; } = new SnapshotDiff(); + public SnapshotDiff 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 *********/ /// A map of tracked locations. - private readonly Dictionary LocationsDict = new Dictionary(new ObjectReferenceComparer()); + private readonly Dictionary LocationsDict = new(new ObjectReferenceComparer()); /********* ** Accessors *********/ /// Tracks changes to the location list. - public SnapshotListDiff LocationList { get; } = new SnapshotListDiff(); + public SnapshotListDiff LocationList { get; } = new(); /// The tracked locations. public IEnumerable Locations => this.LocationsDict.Values; -- cgit