diff options
author | Carl <slxxls92@gmail.com> | 2016-03-08 16:51:13 +0000 |
---|---|---|
committer | Carl <slxxls92@gmail.com> | 2016-03-08 16:51:13 +0000 |
commit | d65c97ab48a1c015d8622e33311c7e2ea8fcd0e5 (patch) | |
tree | 2e7d130a11429bf98d1b5b5042e64d1912b43aee /StardewModdingAPI/Inheritance | |
parent | 38f59b079ec9f24c574d2681a41555038b291b03 (diff) | |
parent | 626452834fed7f15e20f2ecc0d4103be69621193 (diff) | |
download | SMAPI-d65c97ab48a1c015d8622e33311c7e2ea8fcd0e5.tar.gz SMAPI-d65c97ab48a1c015d8622e33311c7e2ea8fcd0e5.tar.bz2 SMAPI-d65c97ab48a1c015d8622e33311c7e2ea8fcd0e5.zip |
Merge pull request #16 from Jtfinlay/dev
Perf improvements
Diffstat (limited to 'StardewModdingAPI/Inheritance')
-rw-r--r-- | StardewModdingAPI/Inheritance/SGame.cs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/StardewModdingAPI/Inheritance/SGame.cs b/StardewModdingAPI/Inheritance/SGame.cs index cccdff23..735cd58a 100644 --- a/StardewModdingAPI/Inheritance/SGame.cs +++ b/StardewModdingAPI/Inheritance/SGame.cs @@ -465,12 +465,13 @@ namespace StardewModdingAPI.Inheritance {
Events.PlayerEvents.InvokeInventoryChanged(player.items, changedItems);
PreviousItems = player.items.Where(n => n != null).ToDictionary(n => n, n => n.Stack);
- }
+ }
- if(currentLocation != null && PreviousLocationObjects != currentLocation.objects.GetHash())
+ var objectHash = currentLocation?.objects?.GetHash();
+ if(objectHash != null && PreviousLocationObjects != objectHash)
{
Events.LocationEvents.InvokeOnNewLocationObject(currentLocation.objects);
- PreviousLocationObjects = currentLocation.objects.GetHash();
+ PreviousLocationObjects = objectHash ?? -1;
}
if (timeOfDay != PreviousTimeOfDay)
|